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" );
|
||||
Loggable::snapshot_callback( &Mixer_Strip::snapshot, this );
|
||||
Loggable::snapshot( filename );
|
||||
return true;
|
||||
}
|
||||
return Loggable::snapshot( filename );
|
||||
}
|
||||
|
||||
bool
|
||||
Mixer_Strip::import_strip ( const char *filename )
|
||||
|
@ -893,9 +892,12 @@ Mixer_Strip::menu_cb ( const Fl_Menu_ *m )
|
|||
free( suggested_name );
|
||||
|
||||
if ( s )
|
||||
export_strip( s );
|
||||
|
||||
{
|
||||
if ( export_strip( s ) )
|
||||
fl_message( "Strip exported." );
|
||||
else
|
||||
fl_alert("Failed to export strip");
|
||||
}
|
||||
}
|
||||
else if ( ! strcmp( picked, "/Remove" ) )
|
||||
{
|
||||
|
|
|
@ -590,20 +590,30 @@ Loggable::snapshot ( const char *name )
|
|||
{
|
||||
FILE *fp;
|
||||
|
||||
char *tmpname;
|
||||
char *tmp = NULL;
|
||||
|
||||
asprintf( &tmpname, ".#%s", name );
|
||||
{
|
||||
const char *filename = basename(name);
|
||||
char *dir = (char*)malloc( (strlen(name) - strlen(filename)) + 1 );
|
||||
strncpy( dir, name, strlen(name) - strlen(filename) );
|
||||
|
||||
if ( ! ( fp = fopen( tmpname, "w" ) ))
|
||||
asprintf( &tmp, "%s#%s", dir, filename );
|
||||
free(dir);
|
||||
}
|
||||
|
||||
if ( ! ( fp = fopen( tmp, "w" ) ))
|
||||
{
|
||||
DWARNING( "Could not open file for writing: %s", tmp );
|
||||
return false;
|
||||
}
|
||||
|
||||
bool r = snapshot( fp );
|
||||
|
||||
fclose( fp );
|
||||
|
||||
rename( tmpname, name );
|
||||
rename( tmp, name );
|
||||
|
||||
free(tmpname);
|
||||
free(tmp);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue