| 36 | #endif |
| 37 | |
| 38 | void FileNames::InitializePathList() |
| 39 | { |
| 40 | const auto programPath = PlatformCompatibility::GetExecutablePath(); |
| 41 | |
| 42 | // |
| 43 | // Paths: set search path and temp dir path |
| 44 | // |
| 45 | FilePaths audacityPathList; |
| 46 | auto &standardPaths = wxStandardPaths::Get(); |
| 47 | |
| 48 | #ifdef __WXGTK__ |
| 49 | const auto portablePrefix = wxPathOnly(wxPathOnly(programPath)); |
| 50 | |
| 51 | // Make sure install prefix is set so wxStandardPath resolves paths properly |
| 52 | if (wxDirExists(portablePrefix + L"/share/audacity")) { |
| 53 | // use prefix relative to executable location to make Audacity portable |
| 54 | standardPaths.SetInstallPrefix(portablePrefix); |
| 55 | } else { |
| 56 | // fallback to hard-coded prefix set during configuration |
| 57 | standardPaths.SetInstallPrefix(wxT(INSTALL_PREFIX)); |
| 58 | } |
| 59 | wxString installPrefix = standardPaths.GetInstallPrefix(); |
| 60 | |
| 61 | /* Search path (for plug-ins, translations etc) is (in this order): |
| 62 | * The AUDACITY_PATH environment variable |
| 63 | * The current directory |
| 64 | * The user's "~/.audacity-data" or "Portable Settings" directory |
| 65 | * The user's "~/.audacity-files" directory |
| 66 | * The "share" and "share/doc" directories in their install path */ |
| 67 | wxString home = wxGetHomeDir(); |
| 68 | |
| 69 | wxString envTempDir = wxGetenv(wxT("TMPDIR")); |
| 70 | if (!envTempDir.empty()) { |
| 71 | /* On Unix systems, the environment variable TMPDIR may point to |
| 72 | an unusual path when /tmp and /var/tmp are not desirable. */ |
| 73 | TempDirectory::SetDefaultTempDir( wxString::Format( |
| 74 | wxT("%s/audacity-%s"), envTempDir, wxGetUserId() ) ); |
| 75 | } else { |
| 76 | /* On Unix systems, the default temp dir is in /var/tmp. */ |
| 77 | TempDirectory::SetDefaultTempDir( wxString::Format( |
| 78 | wxT("/var/tmp/audacity-%s"), wxGetUserId() ) ); |
| 79 | } |
| 80 | |
| 81 | wxString pathVar = wxGetenv(wxT("AUDACITY_PATH")); |
| 82 | |
| 83 | if (!pathVar.empty()) |
| 84 | FileNames::AddMultiPathsToPathList(pathVar, audacityPathList); |
| 85 | FileNames::AddUniquePathToPathList(::wxGetCwd(), audacityPathList); |
| 86 | |
| 87 | const auto progPath = wxPathOnly(programPath); |
| 88 | |
| 89 | FileNames::AddUniquePathToPathList(progPath, audacityPathList); |
| 90 | // Add the path to modules: |
| 91 | FileNames::AddUniquePathToPathList(progPath + L"/lib/audacity", audacityPathList); |
| 92 | |
| 93 | #if !defined(__WXMSW__) |
| 94 | // On Unix systems, the common directory structure is |
| 95 | // .../bin |
nothing calls this directly
no test coverage detected