mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-16 07:06:45 +00:00
Other: Bridge must now be in the same folder as bridge-gui.
This commit is contained in:
@ -32,8 +32,6 @@ QString const exeSuffix;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
QString const exeName = "bridge" + exeSuffix; ///< The bridge executable file name.
|
QString const exeName = "bridge" + exeSuffix; ///< The bridge executable file name.
|
||||||
QString const devDir = "cmd/Desktop-Bridge"; ///< The folder typically containg the bridge executable in a developer's environment.
|
|
||||||
int const maxExeUpwardSeekingDepth = 5; ///< The maximum number of parent folder that will searched when trying to locate the bridge executable.
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -45,23 +43,8 @@ int const maxExeUpwardSeekingDepth = 5; ///< The maximum number of parent folder
|
|||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
QString BridgeMonitor::locateBridgeExe()
|
QString BridgeMonitor::locateBridgeExe()
|
||||||
{
|
{
|
||||||
QString const currentDir = QDir::current().absolutePath();
|
QFileInfo const fileInfo(QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(exeName));
|
||||||
QString const exeDir = QCoreApplication::applicationDirPath();
|
return (fileInfo.exists() && fileInfo.isFile() && fileInfo.isExecutable()) ? fileInfo.absoluteFilePath() : QString();
|
||||||
QStringList dirs = {currentDir, exeDir};
|
|
||||||
for (int i = 0; i <= maxExeUpwardSeekingDepth; ++i)
|
|
||||||
{
|
|
||||||
dirs.append(currentDir + QString("../").repeated(i) + devDir);
|
|
||||||
dirs.append(exeDir + QString("../").repeated(i) + devDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (QString const &dir: dirs)
|
|
||||||
{
|
|
||||||
QFileInfo const fileInfo(QDir(dir).absoluteFilePath(exeName));
|
|
||||||
if (fileInfo.exists() && fileInfo.isFile() && fileInfo.isExecutable())
|
|
||||||
return fileInfo.absoluteFilePath();
|
|
||||||
}
|
|
||||||
|
|
||||||
return QString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user