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

Function exe_path

LASzip/src/mydefs.cpp:358–380  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

356
357/// get the path of the exe file (incl. trailing path delimiter)
358std::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)

Callers 1

open_geo_fileMethod · 0.85

Calls 1

stringFunction · 0.85

Tested by

no test coverage detected