MCPcopy Create free account
hub / github.com/LASzip/LASzip / exe_path

Function exe_path

src/mydefs.cpp:362–384  ·  view source on GitHub ↗

get the path of the exe file (incl. trailing path delimiter)

Source from the content-addressed store, hash-verified

360
361/// get the path of the exe file (incl. trailing path delimiter)
362std::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)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected