ProfileLoader check if regular file
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
2f135cd373
commit
522cb469b7
1 changed files with 14 additions and 8 deletions
|
@ -30,6 +30,7 @@
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#else
|
#else
|
||||||
#include "sys/types.h"
|
#include "sys/types.h"
|
||||||
|
#include "sys/stat.h"
|
||||||
#include "dirent.h"
|
#include "dirent.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@ void ProfileLoader::run()
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
QDir dir(profileFolder);
|
QDir dir(profileFolder);
|
||||||
const QStringList files = dir.entryList();
|
const QStringList files = dir.entryList(QDir::Files);
|
||||||
for (const QString &fileName : files) {
|
for (const QString &fileName : files) {
|
||||||
if (fileName.startsWith("SGTA5") && !fileName.endsWith(".bak")) {
|
if (fileName.startsWith("SGTA5") && !fileName.endsWith(".bak")) {
|
||||||
savegameFiles << fileName;
|
savegameFiles << fileName;
|
||||||
|
@ -63,6 +64,10 @@ void ProfileLoader::run()
|
||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
while ((dp = readdir(dirp)) != 0) {
|
while ((dp = readdir(dirp)) != 0) {
|
||||||
const QString fileName = QString::fromUtf8(dp->d_name);
|
const QString fileName = QString::fromUtf8(dp->d_name);
|
||||||
|
const QString filePath = profileFolder % "/" % fileName;
|
||||||
|
struct stat fileStat;
|
||||||
|
stat(filePath.toUtf8().constData(), &fileStat);
|
||||||
|
if (S_ISREG(fileStat.st_mode) != 0) {
|
||||||
if (fileName.startsWith("SGTA5") && !fileName.endsWith(".bak")) {
|
if (fileName.startsWith("SGTA5") && !fileName.endsWith(".bak")) {
|
||||||
savegameFiles << fileName;
|
savegameFiles << fileName;
|
||||||
maximumV++;
|
maximumV++;
|
||||||
|
@ -72,6 +77,7 @@ void ProfileLoader::run()
|
||||||
maximumV++;
|
maximumV++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue