Mixer: Fix export strip function.
This commit is contained in:
parent
c83aa8ebd8
commit
181dd64689
|
@ -818,9 +818,8 @@ Mixer_Strip::export_strip ( const char *filename )
|
||||||
{
|
{
|
||||||
MESSAGE( "Exporting chain state" );
|
MESSAGE( "Exporting chain state" );
|
||||||
Loggable::snapshot_callback( &Mixer_Strip::snapshot, this );
|
Loggable::snapshot_callback( &Mixer_Strip::snapshot, this );
|
||||||
Loggable::snapshot( filename );
|
return Loggable::snapshot( filename );
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Mixer_Strip::import_strip ( const char *filename )
|
Mixer_Strip::import_strip ( const char *filename )
|
||||||
|
@ -893,9 +892,12 @@ Mixer_Strip::menu_cb ( const Fl_Menu_ *m )
|
||||||
free( suggested_name );
|
free( suggested_name );
|
||||||
|
|
||||||
if ( s )
|
if ( s )
|
||||||
export_strip( s );
|
{
|
||||||
|
if ( export_strip( s ) )
|
||||||
fl_message( "Strip exported." );
|
fl_message( "Strip exported." );
|
||||||
|
else
|
||||||
|
fl_alert("Failed to export strip");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ( ! strcmp( picked, "/Remove" ) )
|
else if ( ! strcmp( picked, "/Remove" ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -590,20 +590,30 @@ Loggable::snapshot ( const char *name )
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
char *tmpname;
|
char *tmp = NULL;
|
||||||
|
|
||||||
|
{
|
||||||
|
const char *filename = basename(name);
|
||||||
|
char *dir = (char*)malloc( (strlen(name) - strlen(filename)) + 1 );
|
||||||
|
strncpy( dir, name, strlen(name) - strlen(filename) );
|
||||||
|
|
||||||
|
asprintf( &tmp, "%s#%s", dir, filename );
|
||||||
|
free(dir);
|
||||||
|
}
|
||||||
|
|
||||||
asprintf( &tmpname, ".#%s", name );
|
if ( ! ( fp = fopen( tmp, "w" ) ))
|
||||||
|
{
|
||||||
if ( ! ( fp = fopen( tmpname, "w" ) ))
|
DWARNING( "Could not open file for writing: %s", tmp );
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool r = snapshot( fp );
|
bool r = snapshot( fp );
|
||||||
|
|
||||||
fclose( fp );
|
fclose( fp );
|
||||||
|
|
||||||
rename( tmpname, name );
|
rename( tmp, name );
|
||||||
|
|
||||||
free(tmpname);
|
free(tmp);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue