1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 09:20:16 +01:00

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, Open,
Save, Save,
Import, Import,
Export Export,
MacrosOut
}; };
enum class PathType { enum class PathType {

View File

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

View File

@@ -122,6 +122,7 @@ enum
SaveTextID, SaveTextID,
ImportTextID, ImportTextID,
ExportTextID, ExportTextID,
MacrosTextID,
TextsEnd, TextsEnd,
ButtonsStart = 1020, ButtonsStart = 1020,
@@ -129,6 +130,7 @@ enum
SaveButtonID, SaveButtonID,
ImportButtonID, ImportButtonID,
ExportButtonID, ExportButtonID,
MacrosButtonID,
ButtonsEnd ButtonsEnd
}; };
@@ -226,6 +228,15 @@ void DirectoriesPrefs::PopulateOrExchange(ShuttleGui &S)
wxT("")}, wxT("")},
30); 30);
S.Id(ExportButtonID).AddButton(XXO("Bro&wse...")); 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(); S.EndMultiColumn();
} }

View File

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