windows....sigh

This commit is contained in:
2026-03-26 12:08:55 +01:00
parent 8fe7e726a4
commit b23365b05f
15 changed files with 499 additions and 128 deletions

29
rktwebview_qt/utils.h Normal file
View File

@@ -0,0 +1,29 @@
#ifndef UTILS_H
#define UTILS_H
#include <string>
inline std::string basedir(const std::string &path)
{
int idx1 = path.rfind("/");
int idx2 = path.rfind("\\");
std::string r;
if (idx1 == std::string::npos && idx2 == std::string::npos) {
r = "";
} else {
int idx;
if (idx1 == std::string::npos) {
idx = idx2;
} else if (idx2 == std::string::npos) {
idx = idx1;
} else if (idx1 < idx2) {
idx = idx2;
} else {
idx = idx1;
}
r = path.substr(0, idx);
}
return r;
}
#endif // UTILS_H