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

Function getDefaultProgramPaths

LASzip/src/mydefs.cpp:804–825  ·  view source on GitHub ↗

Function for determining the standard programme paths

Source from the content-addressed store, hash-verified

802
803/// Function for determining the standard programme paths
804const char** getDefaultProgramPaths(size_t& numPaths) {
805#ifdef _WIN32
806 // Windows: Use environment variables or API for Program Files directories
807 static const char* defaultPaths[] = {getenv("ProgramFiles"), getenv("ProgramFiles(x86)"), "C:\\", nullptr};
808 // Count valid paths
809 numPaths = 0;
810 while (defaultPaths[numPaths] != nullptr) {
811 ++numPaths;
812 }
813 return defaultPaths;
814#elif __APPLE__
815 // macOS: Standard directories
816 static const char* defaultPaths[] = {"/Applications/", "/usr/local/", nullptr};
817 numPaths = sizeof(defaultPaths) / sizeof(defaultPaths[0]) - 1;
818 return defaultPaths;
819#else
820 // Linux/Unix: Standard directories
821 static const char* defaultPaths[] = {"/usr/local/", "/opt/", "/usr/share/", nullptr};
822 numPaths = sizeof(defaultPaths) / sizeof(defaultPaths[0]) - 1;
823 return defaultPaths;
824#endif
825}
826
827/// Function to get the home directory of the current user
828const char* getHomeDirectory() {

Calls

no outgoing calls

Tested by

no test coverage detected