mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-21 14:02:57 +02:00
Defaulting of file paths to Documents is defined in just one place
This commit is contained in:
@@ -30,6 +30,7 @@ used throughout Audacity into this one place.
|
||||
#include "FileNames.h"
|
||||
#include "Internat.h"
|
||||
#include "PlatformCompatibility.h"
|
||||
#include "wxFileNameWrapper.h"
|
||||
|
||||
#if defined(__WXMAC__) || defined(__WXGTK__)
|
||||
#include <dlfcn.h>
|
||||
@@ -315,3 +316,23 @@ wxString FileNames::PathFromAddr(void *addr)
|
||||
|
||||
return name.GetFullPath();
|
||||
}
|
||||
|
||||
wxFileNameWrapper FileNames::DefaultToDocumentsFolder
|
||||
(const wxString &preference)
|
||||
{
|
||||
wxFileNameWrapper result;
|
||||
result.AssignHomeDir();
|
||||
|
||||
#ifdef __WIN32__
|
||||
result.SetPath(gPrefs->Read(
|
||||
preference, result.GetPath(wxPATH_GET_VOLUME) + "\\Documents\\Audacity"));
|
||||
// The path might not exist.
|
||||
// There is no error if the path could not be created. That's OK.
|
||||
// The dialog that Audacity offers will allow the user to select a valid directory.
|
||||
result.Mkdir(0755, wxPATH_MKDIR_FULL);
|
||||
#else
|
||||
result.SetPath(gPrefs->Read( preference, result.GetPath() + "/Documents"));
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user