16#include <wx/stdpaths.h>
19#if HAVE_DLFCN_H && !defined(DISABLE_DLADDR)
20# if __linux__ && !defined(_GNU_SOURCE)
24# define HAVE_GET_LIBRARY_PATH 1
27wxString GetLibraryPath()
31 if (dladdr(
reinterpret_cast<const void*
>(GetLibraryPath), &info))
32 return info.dli_fname;
49 const auto portablePrefix = wxPathOnly(wxPathOnly(programPath));
52 if (wxDirExists(portablePrefix + L
"/share/audacity")) {
54 standardPaths.SetInstallPrefix(portablePrefix);
57 standardPaths.SetInstallPrefix(
wxT(INSTALL_PREFIX));
59 wxString installPrefix = standardPaths.GetInstallPrefix();
67 wxString home = wxGetHomeDir();
69 wxString envTempDir = wxGetenv(
wxT(
"TMPDIR"));
70 if (!envTempDir.empty()) {
74 wxT(
"%s/audacity-%s"), envTempDir, wxGetUserId() ) );
78 wxT(
"/var/tmp/audacity-%s"), wxGetUserId() ) );
81 wxString pathVar = wxGetenv(
wxT(
"AUDACITY_PATH"));
87 const auto progPath = wxPathOnly(programPath);
93#if !defined(__WXMSW__)
97 const wxString progParentPath = wxPathOnly(progPath);
99 if (!progParentPath.IsEmpty())
105#if HAVE_GET_LIBRARY_PATH
106 const wxString thisLibPath = GetLibraryPath();
107 if (!thisLibPath.IsEmpty())
116 home,
wxT(AUDACITY_NAME)),
147 tmpFile.AssignHomeDir();
148 wxString tmpDirLoc = tmpFile.GetPath(wxPATH_GET_VOLUME);
151 tmpFile.AssignTempFileName(
wxT(
"nn"));
152 wxString tmpDirLoc = tmpFile.GetPath(wxPATH_GET_VOLUME);
153 ::wxRemoveFile(tmpFile.GetFullPath());
161 const auto progPath = wxPathOnly(programPath);
168 wxT(
"%s\\SessionData"), tmpDirLoc ) );
173 const auto progPath = wxPathOnly(programPath);
182 progPath +
wxT(
"/../"), audacityPathList);
184 progPath +
wxT(
"/../Resources"), audacityPathList);
189 wxT(
"%s/Library/Application Support/audacity/SessionData"), tmpDirLoc) );
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
FILES_API wxString MkDir(const wxString &Str)
FILES_API void AddUniquePathToPathList(const FilePath &path, FilePaths &pathList)
FILES_API void InitializePathList()
FILES_API void AddMultiPathsToPathList(const wxString &multiPathString, FilePaths &pathList)
FILES_API FilePath DataDir()
Audacity user data directory.
FILES_API FilePath ModulesDir()
FILES_API void SetAudacityPathList(FilePaths list)
FILES_API void SetDefaultTempDir(const FilePath &tempDir)