Function for determining the standard programme paths
| 802 | |
| 803 | /// Function for determining the standard programme paths |
| 804 | const 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 |
| 828 | const char* getHomeDirectory() { |
no outgoing calls
no test coverage detected