cwIoPresetSelApp.cpp : Added automatic backup to 'save' function.
Remove 'frag_panel' field from cfg since 'frag_panel' is now included in 'ui.cfg' resource.
This commit is contained in:
parent
06c5dd18b4
commit
0e68bb0233
@ -209,9 +209,9 @@ namespace cw
|
|||||||
const char* record_dir;
|
const char* record_dir;
|
||||||
const char* record_fn;
|
const char* record_fn;
|
||||||
const char* record_fn_ext;
|
const char* record_fn_ext;
|
||||||
|
const char* record_backup_dir;
|
||||||
const char* scoreFn;
|
const char* scoreFn;
|
||||||
const object_t* midi_play_record_cfg;
|
const object_t* midi_play_record_cfg;
|
||||||
const object_t* frag_panel_cfg;
|
|
||||||
const object_t* presets_cfg;
|
const object_t* presets_cfg;
|
||||||
object_t* flow_proc_dict;
|
object_t* flow_proc_dict;
|
||||||
const object_t* flow_cfg;
|
const object_t* flow_cfg;
|
||||||
@ -276,7 +276,6 @@ namespace cw
|
|||||||
"score_fn", app->scoreFn,
|
"score_fn", app->scoreFn,
|
||||||
"flow_proc_dict_fn",flow_proc_dict_fn,
|
"flow_proc_dict_fn",flow_proc_dict_fn,
|
||||||
"midi_play_record", app->midi_play_record_cfg,
|
"midi_play_record", app->midi_play_record_cfg,
|
||||||
"frag_panel", app->frag_panel_cfg,
|
|
||||||
"presets", app->presets_cfg,
|
"presets", app->presets_cfg,
|
||||||
"crossFadeSrate", app->crossFadeSrate,
|
"crossFadeSrate", app->crossFadeSrate,
|
||||||
"crossFadeCount", app->crossFadeCnt,
|
"crossFadeCount", app->crossFadeCnt,
|
||||||
@ -284,6 +283,7 @@ namespace cw
|
|||||||
"end_play_loc", app->end_play_loc)) != kOkRC )
|
"end_play_loc", app->end_play_loc)) != kOkRC )
|
||||||
{
|
{
|
||||||
rc = cwLogError(kSyntaxErrorRC,"Preset Select App configuration parse failed.");
|
rc = cwLogError(kSyntaxErrorRC,"Preset Select App configuration parse failed.");
|
||||||
|
goto errLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((app->scoreFn = filesys::expandPath( app->scoreFn )) == nullptr )
|
if((app->scoreFn = filesys::expandPath( app->scoreFn )) == nullptr )
|
||||||
@ -298,6 +298,12 @@ namespace cw
|
|||||||
goto errLabel;
|
goto errLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if((app->record_backup_dir = filesys::makeFn(app->record_dir,"backup",nullptr,nullptr)) == nullptr )
|
||||||
|
{
|
||||||
|
rc = cwLogError(kInvalidArgRC,"The record backup directory path is invalid.");
|
||||||
|
goto errLabel;
|
||||||
|
}
|
||||||
|
|
||||||
if((rc = objectFromFile( flow_proc_dict_fn, app->flow_proc_dict )) != kOkRC )
|
if((rc = objectFromFile( flow_proc_dict_fn, app->flow_proc_dict )) != kOkRC )
|
||||||
{
|
{
|
||||||
rc = cwLogError(kInvalidArgRC,"The flow proc file '%s' parse failed.",app->flow_proc_dict);
|
rc = cwLogError(kInvalidArgRC,"The flow proc file '%s' parse failed.",app->flow_proc_dict);
|
||||||
@ -305,10 +311,17 @@ namespace cw
|
|||||||
}
|
}
|
||||||
|
|
||||||
// verify that the output directory exists
|
// verify that the output directory exists
|
||||||
if((rc = filesys::isDir(app->record_dir)) != kOkRC )
|
|
||||||
if((rc = filesys::makeDir(app->record_dir)) != kOkRC )
|
if((rc = filesys::makeDir(app->record_dir)) != kOkRC )
|
||||||
|
{
|
||||||
rc = cwLogError(rc,"Unable to create the base output directory:%s.",cwStringNullGuard(app->record_dir));
|
rc = cwLogError(rc,"Unable to create the base output directory:%s.",cwStringNullGuard(app->record_dir));
|
||||||
|
goto errLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
// verify that the output backup directory exists
|
||||||
|
if((rc = filesys::makeDir(app->record_backup_dir)) != kOkRC )
|
||||||
|
{
|
||||||
|
rc = cwLogError(rc,"Unable to create the output backup directory:%s.",cwStringNullGuard(app->record_backup_dir));
|
||||||
|
}
|
||||||
|
|
||||||
app->insertLoc = kInvalidId; // initialize 'insertLoc' to be invalid
|
app->insertLoc = kInvalidId; // initialize 'insertLoc' to be invalid
|
||||||
|
|
||||||
@ -354,6 +367,7 @@ namespace cw
|
|||||||
if( app.flow_proc_dict != nullptr )
|
if( app.flow_proc_dict != nullptr )
|
||||||
app.flow_proc_dict->free();
|
app.flow_proc_dict->free();
|
||||||
|
|
||||||
|
mem::release((char*&)app.record_backup_dir);
|
||||||
mem::release((char*&)app.record_dir);
|
mem::release((char*&)app.record_dir);
|
||||||
mem::release((char*&)app.scoreFn);
|
mem::release((char*&)app.scoreFn);
|
||||||
preset_sel::destroy(app.psH);
|
preset_sel::destroy(app.psH);
|
||||||
@ -1129,12 +1143,19 @@ namespace cw
|
|||||||
char* fn = nullptr;
|
char* fn = nullptr;
|
||||||
|
|
||||||
// form the output file name
|
// form the output file name
|
||||||
if((fn = filesys::makeFn(app->record_dir, app->record_fn, app->record_fn_ext, NULL)) == nullptr )
|
if((fn = filesys::makeFn(app->record_dir, app->record_fn, app->record_fn_ext, nullptr)) == nullptr )
|
||||||
{
|
{
|
||||||
rc = cwLogError(kOpFailRC,"The preset select filename could not formed.");
|
rc = cwLogError(kOpFailRC,"The preset select filename could not formed.");
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// backup the current output file to versioned copy
|
||||||
|
if((rc = file::backup( app->record_dir, app->record_fn, app->record_fn_ext, app->record_backup_dir )) != kOkRC )
|
||||||
|
{
|
||||||
|
rc = cwLogError(kOpFailRC,"The preset select backup to '%s' failed.",cwStringNullGuard(app->record_backup_dir));
|
||||||
|
goto errLabel;
|
||||||
|
}
|
||||||
|
|
||||||
// write the preset data file
|
// write the preset data file
|
||||||
if((rc = preset_sel::write( app->psH, fn)) != kOkRC )
|
if((rc = preset_sel::write( app->psH, fn)) != kOkRC )
|
||||||
{
|
{
|
||||||
@ -1293,7 +1314,7 @@ namespace cw
|
|||||||
goto errLabel;
|
goto errLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kLoadBtnId ), true );
|
//io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kLoadBtnId ), true );
|
||||||
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kSaveBtnId ), true );
|
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kSaveBtnId ), true );
|
||||||
|
|
||||||
|
|
||||||
@ -1400,13 +1421,6 @@ namespace cw
|
|||||||
loc_map_t* loc_ts = nullptr;
|
loc_map_t* loc_ts = nullptr;
|
||||||
const preset_sel::frag_t* f = nullptr;;
|
const preset_sel::frag_t* f = nullptr;;
|
||||||
|
|
||||||
// verify that frag panel resource object is initiailized
|
|
||||||
if( app->frag_panel_cfg == nullptr)
|
|
||||||
{
|
|
||||||
rc = cwLogError(kInvalidStateRC,"The fragment UI resource was not initialized.");
|
|
||||||
goto errLabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
// verify that the insertion location is valid
|
// verify that the insertion location is valid
|
||||||
if( app->insertLoc == kInvalidId )
|
if( app->insertLoc == kInvalidId )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user