mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 15:45:46 +08:00
Ref T436, correct file name handling (UNC) and validate FSX position
This commit is contained in:
@@ -140,13 +140,18 @@ namespace BlackMisc
|
||||
{
|
||||
CStatusMessageList msgs;
|
||||
const ModelType t = this->getModelType();
|
||||
if (t == TypeOwnSimulatorModel || t == TypeManuallySet || t == TypeDatabaseEntry)
|
||||
if (t == TypeOwnSimulatorModel || t == TypeManuallySet || t == TypeDatabaseEntry || t == TypeModelMatching || t == TypeModelMatchingDefaultModel)
|
||||
{
|
||||
if (!this->hasExistingCorrespondingFile())
|
||||
{
|
||||
const CStatusMessage m = CStatusMessage(this).validationError("File '%1' not readable") << this->getFileName();
|
||||
msgs.push_back(m);
|
||||
}
|
||||
else
|
||||
{
|
||||
const CStatusMessage m = CStatusMessage(this).validationInfo("File '%1' existing") << this->getFileName();
|
||||
msgs.push_back(m);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -682,7 +687,7 @@ namespace BlackMisc
|
||||
bool CAircraftModel::hasExistingCorrespondingFile() const
|
||||
{
|
||||
if (!this->hasFileName()) { return false; }
|
||||
const QFileInfo fi(this->getFileName());
|
||||
const QFileInfo fi(CFileUtils::fixWindowsUncPath(this->getFileName()));
|
||||
return (fi.exists() && fi.isReadable());
|
||||
}
|
||||
|
||||
|
||||
@@ -222,10 +222,11 @@ namespace BlackMisc
|
||||
// unfortunately some files are malformed which could end up in wrong data
|
||||
|
||||
ok = false;
|
||||
QFile file(fileName); // includes path
|
||||
const QString fnFixed = CFileUtils::fixWindowsUncPath(fileName);
|
||||
QFile file(fnFixed); // includes path
|
||||
if (!file.open(QFile::ReadOnly | QFile::Text))
|
||||
{
|
||||
const CStatusMessage m = CStatusMessage(getLogCategories()).warning("Unable to read file '%1'") << fileName;
|
||||
const CStatusMessage m = CStatusMessage(getLogCategories()).warning("Unable to read file '%1'") << fnFixed;
|
||||
msgs.push_back(m);
|
||||
return CAircraftCfgEntriesList();
|
||||
}
|
||||
@@ -352,7 +353,7 @@ namespace BlackMisc
|
||||
file.close();
|
||||
|
||||
// store all entries
|
||||
const QFileInfo fileInfo(fileName);
|
||||
const QFileInfo fileInfo(fnFixed);
|
||||
QDateTime fileTimestamp(fileInfo.lastModified());
|
||||
if (!fileTimestamp.isValid() || fileInfo.created() > fileTimestamp)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user