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