mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 09:01:39 -05:00
-Fixed issue with save paths, now adheres to NSM standard saving mechanisms
This commit is contained in:
parent
0a9471cf54
commit
6579fdd085
3 changed files with 19 additions and 11 deletions
|
@ -51,7 +51,7 @@ int DiskReader::loadPreferences()
|
|||
cJSON* ctlrs = cJSON_GetObjectItem( preferencesJson, "defaultControllers" );
|
||||
if ( ctlrs )
|
||||
{
|
||||
//cout << ".nanba HAS items." << endl;
|
||||
//cout << ".ctlr HAS items." << endl;
|
||||
int nCtlrs = cJSON_GetArraySize( ctlrs );
|
||||
for(int i = 0; i < nCtlrs; i++ )
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ int DiskReader::loadPreferences()
|
|||
}
|
||||
else
|
||||
{
|
||||
cout << "Warning: .nanba has no items." << endl;
|
||||
LUPPP_NOTE("No default controllers active.");
|
||||
}
|
||||
|
||||
cJSON_Delete( preferencesJson );
|
||||
|
@ -223,10 +223,10 @@ int DiskReader::readSession( std::string path )
|
|||
s << path << "/session.luppp";
|
||||
|
||||
stringstream samplePath;
|
||||
samplePath << path << "/samples/sample.cfg";
|
||||
samplePath << path << "/audio/audio.cfg";
|
||||
|
||||
cout << "session path: " << s.str() << endl;
|
||||
cout << "sample path: " << samplePath.str() << endl;
|
||||
cout << "audio path: " << samplePath.str() << endl;
|
||||
|
||||
// open session, read all
|
||||
std::ifstream file( s.str().c_str(), std::ios_base::in|std::ios_base::ate);
|
||||
|
|
|
@ -37,27 +37,34 @@ void DiskWriter::initialize(std::string path, std::string name )
|
|||
|
||||
// write session.luppp JSON node to <path>/<sessionName>.luppp
|
||||
stringstream sessionDirStream;
|
||||
sessionDirStream << path << "/" << sessionName;
|
||||
|
||||
sessionDirStream << path;
|
||||
|
||||
if ( !gui->getNsm() )
|
||||
sessionDirStream << "/" << sessionName;
|
||||
|
||||
sessionDir = sessionDirStream.str();
|
||||
|
||||
LUPPP_NOTE( "Creating session dir %s", sessionDir.c_str() );
|
||||
|
||||
int sessionDirError = mkdir( sessionDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH );
|
||||
if ( sessionDirError )
|
||||
{
|
||||
// handle by using different filename?
|
||||
LUPPP_WARN("%s","Error creating session directory");
|
||||
LUPPP_WARN("Error creating session directory");
|
||||
}
|
||||
|
||||
stringstream audioDirStream;
|
||||
audioDirStream << sessionDir << "/audio";
|
||||
audioDir = audioDirStream.str();
|
||||
LUPPP_NOTE("%s %s","Creating audio dir ", audioDir.c_str() );
|
||||
LUPPP_NOTE("Creating audio dir %s", audioDir.c_str() );
|
||||
|
||||
int audioDirError = mkdir( audioDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH );
|
||||
|
||||
// FIXME: error check mkdir for error return
|
||||
if ( audioDirError )
|
||||
{
|
||||
LUPPP_WARN("%s","Error creating sample directory");
|
||||
LUPPP_WARN("Error creating sample directory");
|
||||
}
|
||||
|
||||
foldersCreated = true;
|
||||
|
|
|
@ -237,10 +237,11 @@ static int cb_nsm_open (const char *name,
|
|||
|
||||
Jack::setup( client_id );
|
||||
|
||||
|
||||
stringstream loadPath;
|
||||
loadPath << name;
|
||||
|
||||
// load the NSM provided directory
|
||||
gui->getDiskReader()->readSession( name );
|
||||
gui->getDiskReader()->readSession( loadPath.str() );
|
||||
|
||||
// initialize the disk-writer to the same directory:
|
||||
// we *always* overwrite the old save file when using NSM
|
||||
|
@ -251,7 +252,7 @@ static int cb_nsm_open (const char *name,
|
|||
|
||||
static int cb_nsm_save ( char **out_msg, void *userdata )
|
||||
{
|
||||
LUPPP_NOTE("NSM: saving session as %s", *out_msg );
|
||||
LUPPP_NOTE("NSM: saving..." );
|
||||
|
||||
// disk-writer already initialized to the right directory, so just write!
|
||||
EventStateSave e;
|
||||
|
|
Loading…
Add table
Reference in a new issue