improve file dialog experience

This commit is contained in:
Syping 2023-05-13 01:17:46 +02:00
parent 09d79228a0
commit 40675f605d
4 changed files with 14 additions and 13 deletions

View file

@ -55,10 +55,10 @@ QString AppEnv::getGameFolder(bool *ok)
{
QDir dir;
QString GTAV_FOLDER = QString::fromUtf8(qgetenv("GTAV_FOLDER"));
if (GTAV_FOLDER != "") {
if (!GTAV_FOLDER.isEmpty()) {
dir.setPath(GTAV_FOLDER);
if (dir.exists()) {
if (ok != NULL)
if (ok)
*ok = true;
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
return dir.absolutePath();
@ -77,7 +77,7 @@ QString AppEnv::getGameFolder(bool *ok)
if (forceDir) {
dir.setPath(GTAV_returnFolder);
if (dir.exists()) {
if (ok != 0)
if (ok)
*ok = true;
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
return dir.absolutePath();
@ -86,7 +86,7 @@ QString AppEnv::getGameFolder(bool *ok)
dir.setPath(GTAV_defaultFolder);
if (dir.exists()) {
if (ok != 0)
if (ok)
*ok = true;
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
return dir.absolutePath();
@ -95,14 +95,14 @@ QString AppEnv::getGameFolder(bool *ok)
if (!forceDir) {
dir.setPath(GTAV_returnFolder);
if (dir.exists()) {
if (ok != 0)
if (ok)
*ok = true;
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
return dir.absolutePath();
}
}
if (ok != 0)
if (ok)
*ok = false;
return QString();
}