1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-31 16:09:28 +02:00

Add command line option to decode autosave files

On Windows, you use:

/d <filename>
--decode <filename>

On Linux and OSX, you use:

-d <filename>
--decode <filename>

Note that the input (binary) file IS replaced with the decoded
XML file.
This commit is contained in:
Leland Lucius 2015-04-18 23:59:52 -05:00
parent 7db0eebd65
commit 5d415e69d5
2 changed files with 21 additions and 2 deletions

View File

@ -1371,6 +1371,21 @@ Click the 'Help' button for known issue."),
Sequence::SetMaxDiskBlockSize(lval);
}
wxString fileName;
if (parser->Found(wxT("d"), &fileName))
{
AutoSaveFile asf;
if (asf.Decode(fileName))
{
wxPrintf(_("File decoded successfully\n"));
}
else
{
wxPrintf(_("Decoding failed\n"));
}
exit(1);
}
// No Splash screen on wx3 whislt we sort out the problem
// with showing a dialog AND a splash screen during inits.
#if !wxCHECK_VERSION(3, 0, 0)
@ -1814,6 +1829,10 @@ wxCmdLineParser *AudacityApp::ParseCommandLine()
parser->AddOption(wxT("b"), wxT("blocksize"), _("set max disk block size in bytes"),
wxCMD_LINE_VAL_NUMBER);
/*i18n-hint: This decodes an autosave file */
parser->AddOption(wxT("d"), wxT("decode"), _("decode an autosave file"),
wxCMD_LINE_VAL_STRING);
/*i18n-hint: This displays a list of available options */
parser->AddSwitch(wxT("h"), wxT("help"), _("this help message"),
wxCMD_LINE_OPTION_HELP);

View File

@ -66,8 +66,8 @@ private:
#define AutoSaveIdent "<?xml autosave>"
WX_DECLARE_STRING_HASH_MAP_WITH_DECL(short, NameMap, class AUDACITY_DLL_API);
WX_DECLARE_HASH_MAP(short, wxString, wxIntegerHash, wxIntegerEqual, IdMap);
WX_DECLARE_OBJARRAY(IdMap, IdMapArray);
WX_DECLARE_HASH_MAP_WITH_DECL(short, wxString, wxIntegerHash, wxIntegerEqual, IdMap, class AUDACITY_DLL_API);
WX_DECLARE_OBJARRAY_WITH_DECL(IdMap, IdMapArray, class AUDACITY_DLL_API);
class AUDACITY_DLL_API AutoSaveFile : public XMLWriter
{