mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-05 09:45:44 +08:00
refs #911, support for Windows UNC paths in parser
This commit is contained in:
committed by
Mathew Sutcliffe
parent
b0fe4ce930
commit
6d97f477c9
@@ -346,4 +346,12 @@ namespace BlackMisc
|
|||||||
default: return QStringLiteral("Bad error number");
|
default: return QStringLiteral("Bad error number");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CFileUtils::fixWindowsUncPath(const QString &filePath)
|
||||||
|
{
|
||||||
|
if (!filePath.startsWith('/')) { return filePath; }
|
||||||
|
if (filePath.startsWith("//")) { return filePath; }
|
||||||
|
static const QString f("/%1");
|
||||||
|
return f.arg(filePath);
|
||||||
|
}
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -126,6 +126,10 @@ namespace BlackMisc
|
|||||||
|
|
||||||
//! Error message explaining why a QLockFile failed to lock.
|
//! Error message explaining why a QLockFile failed to lock.
|
||||||
static QString lockFileError(const QLockFile &lockFile);
|
static QString lockFileError(const QLockFile &lockFile);
|
||||||
|
|
||||||
|
//! UNC file paths on Qt start with "/", but UNC file paths only work when they start with "//"
|
||||||
|
//! \remark On Windows starting with "/" means an UNC path, on UNIX it varies, see http://unix.stackexchange.com/a/12291/19428
|
||||||
|
static QString fixWindowsUncPath(const QString &filePath);
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,9 @@ namespace BlackMisc
|
|||||||
static const CStatusMessage statusLoadingError(this, CStatusMessage::SeverityError, "Aircraft config parser did not load data");
|
static const CStatusMessage statusLoadingError(this, CStatusMessage::SeverityError, "Aircraft config parser did not load data");
|
||||||
|
|
||||||
const CSimulatorInfo simulator = this->getSimulator();
|
const CSimulatorInfo simulator = this->getSimulator();
|
||||||
const QString modelDirectory(!directory.isEmpty() ? directory : this->m_settings.getFirstModelDirectoryOrDefault(simulator)); // expect only one directory
|
const QString modelDirectory = CFileUtils::fixWindowsUncPath(
|
||||||
|
directory.isEmpty() ? this->m_settings.getFirstModelDirectoryOrDefault(simulator) : directory
|
||||||
|
); // expect only one directory
|
||||||
const QStringList excludedDirectoryPatterns(this->m_settings.getModelExcludeDirectoryPatternsOrDefault(simulator)); // copy
|
const QStringList excludedDirectoryPatterns(this->m_settings.getModelExcludeDirectoryPatternsOrDefault(simulator)); // copy
|
||||||
|
|
||||||
if (mode.testFlag(LoadInBackground))
|
if (mode.testFlag(LoadInBackground))
|
||||||
@@ -170,7 +172,7 @@ namespace BlackMisc
|
|||||||
return CAircraftCfgEntriesList(); // can happen if there are shortcuts or linked dirs not available
|
return CAircraftCfgEntriesList(); // can happen if there are shortcuts or linked dirs not available
|
||||||
}
|
}
|
||||||
|
|
||||||
QString currentDir = dir.absolutePath();
|
const QString currentDir = dir.absolutePath();
|
||||||
CAircraftCfgEntriesList result;
|
CAircraftCfgEntriesList result;
|
||||||
|
|
||||||
// Dirs last is crucial,since I will break recursion on "aircraft.cfg" level
|
// Dirs last is crucial,since I will break recursion on "aircraft.cfg" level
|
||||||
|
|||||||
Reference in New Issue
Block a user