Bug 2734 - Apply macro may not create the macro-output folder in the source directory

Now macro-output is placed in your default documents folder (if no
path specified) or in the path you specify (if a path was specified).
This commit is contained in:
James Crook 2021-04-09 19:05:19 +01:00
parent e22af714af
commit 9e3c98202f
4 changed files with 19 additions and 1 deletions

View File

@ -138,7 +138,8 @@ namespace FileNames
Open,
Save,
Import,
Export
Export,
MacrosOut
};
enum class PathType {

View File

@ -61,6 +61,10 @@ void DoExport(AudacityProject &project, const FileExtension &format)
success = e.Process(false, t0, t1);
}
else {
// 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 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
// want to use the project's path if it has been saved, otherwise use the
@ -68,6 +72,7 @@ void DoExport(AudacityProject &project, const FileExtension &format)
FilePath pathName = !projectFileIO.IsTemporary() ?
wxPathOnly(projectFileIO.GetFileName()) :
project.GetInitialImportPath();
*/
wxFileName fileName(pathName, projectName, format.Lower());
// Append the "macro-output" directory to the path

View File

@ -122,6 +122,7 @@ enum
SaveTextID,
ImportTextID,
ExportTextID,
MacrosTextID,
TextsEnd,
ButtonsStart = 1020,
@ -129,6 +130,7 @@ enum
SaveButtonID,
ImportButtonID,
ExportButtonID,
MacrosButtonID,
ButtonsEnd
};
@ -226,6 +228,15 @@ void DirectoriesPrefs::PopulateOrExchange(ShuttleGui &S)
wxT("")},
30);
S.Id(ExportButtonID).AddButton(XXO("Bro&wse..."));
S.Id(MacrosTextID);
mMacrosText = S.TieTextBox(XXO("&Macro output:"),
{PreferenceKey(Operation::MacrosOut, PathType::User),
wxT("")},
30);
S.Id(MacrosButtonID).AddButton(XXO("Bro&wse..."));
}
S.EndMultiColumn();
}

View File

@ -49,6 +49,7 @@ class DirectoriesPrefs final : public PrefsPanel
wxTextCtrl *mSaveText;
wxTextCtrl *mImportText;
wxTextCtrl *mExportText;
wxTextCtrl *mMacrosText;
DECLARE_EVENT_TABLE()
};