mirror of https://github.com/kiwix/libkiwix.git
+ fix fileExists() for Windows
This commit is contained in:
parent
c894e50344
commit
f69edcf9c0
|
@ -24,6 +24,7 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include "Shlwapi.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -167,6 +168,9 @@ string getFileSizeAsString(const string &path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fileExists(const string &path) {
|
bool fileExists(const string &path) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
return PathFileExists(path.c_str());
|
||||||
|
#else
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
fstream fin;
|
fstream fin;
|
||||||
fin.open(path.c_str(), ios::in);
|
fin.open(path.c_str(), ios::in);
|
||||||
|
@ -175,6 +179,7 @@ bool fileExists(const string &path) {
|
||||||
}
|
}
|
||||||
fin.close();
|
fin.close();
|
||||||
return flag;
|
return flag;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool makeDirectory(const string &path) {
|
bool makeDirectory(const string &path) {
|
||||||
|
|
Loading…
Reference in New Issue