mirror of https://github.com/kiwix/libkiwix.git
+ replace C code with C++
This commit is contained in:
parent
f4dc0a43e0
commit
e9740183c2
|
@ -105,9 +105,8 @@ unsigned int getFileSize(const string &path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
string getFileSizeAsString(const string &path) {
|
string getFileSizeAsString(const string &path) {
|
||||||
char csize[42];
|
ostringstream convert; convert << getFileSize(path);
|
||||||
sprintf(csize, "%u", getFileSize(path));
|
return convert.str();
|
||||||
return csize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fileExists(const string &path) {
|
bool fileExists(const string &path) {
|
||||||
|
@ -152,7 +151,8 @@ string getExecutablePath() {
|
||||||
uint32_t max = (uint32_t)PATH_MAX;
|
uint32_t max = (uint32_t)PATH_MAX;
|
||||||
_NSGetExecutablePath(binRootPath, &max);
|
_NSGetExecutablePath(binRootPath, &max);
|
||||||
#else
|
#else
|
||||||
readlink("/proc/self/exe", binRootPath, PATH_MAX);
|
if (readlink("/proc/self/exe", binRootPath, PATH_MAX) == -1) {
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return std::string(binRootPath);
|
return std::string(binRootPath);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#define KIWIX_PATHTOOLS_H
|
#define KIWIX_PATHTOOLS_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
Loading…
Reference in New Issue