get the path of the exe file (incl. trailing path delimiter)
| 360 | |
| 361 | /// get the path of the exe file (incl. trailing path delimiter) |
| 362 | std::string exe_path() { |
| 363 | size_t len = 0; |
| 364 | #ifdef _WIN32 |
| 365 | TCHAR path[MAX_PATH_LAS]; |
| 366 | GetModuleFileName(NULL, path, MAX_PATH_LAS); |
| 367 | #ifdef UNICODE |
| 368 | len = wcslen(path); |
| 369 | #else |
| 370 | len = strlen(path); |
| 371 | #endif |
| 372 | #else |
| 373 | char path[MAX_PATH_LAS]; |
| 374 | len = readlink("/proc/self/exe", path, MAX_PATH_LAS); |
| 375 | #endif |
| 376 | while (len && (path[len] != '\\') && (path[len] != '/')) len--; |
| 377 | path[len] = '\0'; |
| 378 | // |
| 379 | #if defined(_WIN32) && defined(UNICODE) |
| 380 | return bufferWToString(path, len) + DIRECTORY_SLASH; |
| 381 | #else |
| 382 | return std::string(path, len) + DIRECTORY_SLASH; |
| 383 | #endif |
| 384 | } |
| 385 | |
| 386 | /// <summary> |
| 387 | /// get the current directory (exclude trailing delimiter) |
nothing calls this directly
no outgoing calls
no test coverage detected