| 149 | } |
| 150 | |
| 151 | string GetMainDirFromExePath(const char *argv_0) { |
| 152 | string md = SanitizePath(argv_0); |
| 153 | #ifdef _WIN32 |
| 154 | // Windows can pass just the exe name without a full path, which is useless. |
| 155 | char winfn[MAX_PATH + 1]; |
| 156 | GetModuleFileName(NULL, winfn, MAX_PATH + 1); |
| 157 | md = winfn; |
| 158 | #endif |
| 159 | #ifdef __linux__ |
| 160 | char path[PATH_MAX]; |
| 161 | ssize_t length = readlink("/proc/self/exe", path, sizeof(path)-1); |
| 162 | if (length != -1) { |
| 163 | path[length] = '\0'; |
| 164 | md = string(path); |
| 165 | } |
| 166 | #endif |
| 167 | md = StripTrailing(StripTrailing(StripFilePart(md), "bin/"), "bin\\"); |
| 168 | return md; |
| 169 | } |
| 170 | |
| 171 | int64_t DefaultLoadFile(string_view absfilename, string *dest, int64_t start, int64_t len) { |
| 172 | LOG_INFO("DefaultLoadFile: ", absfilename); |
no test coverage detected