1
0
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:
Paul Licameli
2017-08-01 15:11:56 -04:00
parent d7ac0d30db
commit a9d4c2c05b
5 changed files with 30 additions and 30 deletions

View File

@@ -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;
}