mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-05 09:45:44 +08:00
Ref T253, utility functions to support UNC
This commit is contained in:
@@ -114,6 +114,11 @@ namespace BlackMisc
|
|||||||
return QDir::cleanPath(path1 + QChar('/') + path2);
|
return QDir::cleanPath(path1 + QChar('/') + path2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CFileUtils::appendFilePathsAndFixUnc(const QString &path1, const QString &path2)
|
||||||
|
{
|
||||||
|
return CFileUtils::fixWindowsUncPath(appendFilePaths(path1, path2));
|
||||||
|
}
|
||||||
|
|
||||||
QString CFileUtils::stripFileFromPath(const QString &path)
|
QString CFileUtils::stripFileFromPath(const QString &path)
|
||||||
{
|
{
|
||||||
if (path.endsWith('/')) { return path; }
|
if (path.endsWith('/')) { return path; }
|
||||||
@@ -126,6 +131,11 @@ namespace BlackMisc
|
|||||||
return CFileUtils::appendFilePaths(CFileUtils::appendFilePaths(path1, path2), path3);
|
return CFileUtils::appendFilePaths(CFileUtils::appendFilePaths(path1, path2), path3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CFileUtils::appendFilePathsAndFixUnc(const QString &path1, const QString &path2, const QString &path3)
|
||||||
|
{
|
||||||
|
return CFileUtils::fixWindowsUncPath(CFileUtils::appendFilePaths(CFileUtils::appendFilePaths(path1, path2), path3));
|
||||||
|
}
|
||||||
|
|
||||||
bool CFileUtils::copyRecursively(const QString &sourceDir, const QString &destinationDir)
|
bool CFileUtils::copyRecursively(const QString &sourceDir, const QString &destinationDir)
|
||||||
{
|
{
|
||||||
QFileInfo sourceFileInfo(sourceDir);
|
QFileInfo sourceFileInfo(sourceDir);
|
||||||
|
|||||||
@@ -67,13 +67,21 @@ namespace BlackMisc
|
|||||||
//! \sa CNetworkUtils::buildUrl for URLs
|
//! \sa CNetworkUtils::buildUrl for URLs
|
||||||
static QString appendFilePaths(const QString &path1, const QString &path2);
|
static QString appendFilePaths(const QString &path1, const QString &path2);
|
||||||
|
|
||||||
//! Strip file from path a/b/c.json a/b
|
//! Append file paths
|
||||||
static QString stripFileFromPath(const QString &path);
|
//! \sa CNetworkUtils::buildUrl for URLs
|
||||||
|
static QString appendFilePathsAndFixUnc(const QString &path1, const QString &path2);
|
||||||
|
|
||||||
//! Append file paths
|
//! Append file paths
|
||||||
//! \sa CNetworkUtils::buildUrl for URLs
|
//! \sa CNetworkUtils::buildUrl for URLs
|
||||||
static QString appendFilePaths(const QString &path1, const QString &path2, const QString &path3);
|
static QString appendFilePaths(const QString &path1, const QString &path2, const QString &path3);
|
||||||
|
|
||||||
|
//! Append file paths
|
||||||
|
//! \sa CNetworkUtils::buildUrl for URLs
|
||||||
|
static QString appendFilePathsAndFixUnc(const QString &path1, const QString &path2, const QString &path3);
|
||||||
|
|
||||||
|
//! Strip file from path a/b/c.json a/b
|
||||||
|
static QString stripFileFromPath(const QString &path);
|
||||||
|
|
||||||
//! If `sourceDir` is a directory, copies it recursively, so that `sourceDir` becomes `destinationDir`.
|
//! If `sourceDir` is a directory, copies it recursively, so that `sourceDir` becomes `destinationDir`.
|
||||||
//! If it is a file, just copies the file.
|
//! If it is a file, just copies the file.
|
||||||
static bool copyRecursively(const QString &sourceDir, const QString &destinationDir);
|
static bool copyRecursively(const QString &sourceDir, const QString &destinationDir);
|
||||||
|
|||||||
@@ -567,7 +567,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
const QString CXPlaneSimulatorSettings::getPluginDirOrDefault() const
|
const QString CXPlaneSimulatorSettings::getPluginDirOrDefault() const
|
||||||
{
|
{
|
||||||
return CFileUtils::appendFilePaths(this->getSimulatorDirectoryOrDefault(), CXPlaneUtil::xplanePluginPath());
|
return CFileUtils::appendFilePathsAndFixUnc(this->getSimulatorDirectoryOrDefault(), CXPlaneUtil::xplanePluginPath());
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
Reference in New Issue
Block a user