Skip to content

Commit

Permalink
Use temp directory if we fail to create our own path (#9872)
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Dec 7, 2022
1 parent e4dff28 commit 38d0683
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions OMEdit/OMEditLIB/Util/Utilities.cpp
Expand Up @@ -556,8 +556,14 @@ QString& Utilities::tempDirectory()
tmpPath = QDir::tempPath() + "/OpenModelica_" + QString(user ? user : "nobody") + "/OMEdit/";
#endif
tmpPath.remove("\"");
if (!QDir().exists(tmpPath))
QDir().mkpath(tmpPath);
if (!QDir().exists(tmpPath)) {
if (!QDir().mkpath(tmpPath)) {
qDebug() << "Failed to create the tempDirectory" << tmpPath
<< "will use" << QDir::tempPath() << "instead.";
tmpPath = QDir::tempPath();
tmpPath.remove("\"");
}
}
}
return tmpPath;
}
Expand Down

0 comments on commit 38d0683

Please sign in to comment.