mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-01 16:19:43 +02:00
Add additional checks for macro output directory.
This bug still available in case: using old settings file or manual set it into settings file.
This commit is contained in:
parent
7e2b7e68ad
commit
a0ea8b63ad
@ -716,6 +716,22 @@ char *FileNames::VerifyFilename(const wxString &s, bool input)
|
||||
}
|
||||
#endif
|
||||
|
||||
bool FileNames::WritableLocationCheck(const FilePath& path)
|
||||
{
|
||||
bool status = wxFileName::IsDirWritable(path);
|
||||
|
||||
if (!status)
|
||||
{
|
||||
AudacityMessageBox(
|
||||
XO("Directory %s does not have write permissions")
|
||||
.Format(path),
|
||||
XO("Error"),
|
||||
wxOK | wxICON_ERROR);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
// Using this with wxStringArray::Sort will give you a list that
|
||||
// is alphabetical, without depending on case. If you use the
|
||||
// default sort, you will get strings with 'R' before 'a', because it is in caps.
|
||||
|
@ -221,6 +221,9 @@ namespace FileNames
|
||||
AUDACITY_DLL_API char *VerifyFilename(const wxString &s, bool input = true);
|
||||
#endif
|
||||
|
||||
//! Check location on writable access and return true if checked successfully.
|
||||
AUDACITY_DLL_API bool WritableLocationCheck(const FilePath& path);
|
||||
|
||||
// wxString compare function for sorting case, which is needed to load correctly.
|
||||
AUDACITY_DLL_API int CompareNoCase(const wxString& first, const wxString& second);
|
||||
|
||||
|
@ -63,6 +63,11 @@ void DoExport(AudacityProject &project, const FileExtension &format)
|
||||
// We either use a configured output path,
|
||||
// or we use the default documents folder - just as for exports.
|
||||
FilePath pathName = FileNames::FindDefaultPath(FileNames::Operation::MacrosOut);
|
||||
|
||||
if (!FileNames::WritableLocationCheck(pathName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
/*
|
||||
// If we've gotten to this point, we are in batch mode, have a file format,
|
||||
// and the project has either been saved or a file has been imported. So, we
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "../widgets/AudacityMessageBox.h"
|
||||
#include "../widgets/ReadOnlyText.h"
|
||||
#include "../widgets/wxTextCtrlWrapper.h"
|
||||
#include "../FileNames.h"
|
||||
|
||||
using namespace FileNames;
|
||||
using namespace TempDirectory;
|
||||
@ -267,22 +268,6 @@ void DirectoriesPrefs::PopulateOrExchange(ShuttleGui &S)
|
||||
S.EndScroller();
|
||||
}
|
||||
|
||||
bool WritableLocationCheck(const FilePath &path)
|
||||
{
|
||||
bool Status = wxFileName ::IsDirWritable(path);
|
||||
if (!Status)
|
||||
{
|
||||
AudacityMessageBox(
|
||||
XO("Directory %s does not have write permissions")
|
||||
.Format(path),
|
||||
XO("Error"),
|
||||
wxOK | wxICON_ERROR);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void DirectoriesPrefs::OnTempBrowse(wxCommandEvent &evt)
|
||||
{
|
||||
wxString oldTemp = gPrefs->Read(PreferenceKey(Operation::Open, PathType::_None),
|
||||
@ -311,7 +296,7 @@ void DirectoriesPrefs::OnTempBrowse(wxCommandEvent &evt)
|
||||
return;
|
||||
}
|
||||
|
||||
if (WritableLocationCheck(dlog.GetPath()))
|
||||
if (!FileNames::WritableLocationCheck(dlog.GetPath()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -392,7 +377,7 @@ void DirectoriesPrefs::OnBrowse(wxCommandEvent &evt)
|
||||
}
|
||||
}
|
||||
|
||||
if (WritableLocationCheck(dlog.GetPath()))
|
||||
if (!FileNames::WritableLocationCheck(dlog.GetPath()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user