Change MixerSnapshotManager::remove to use new erase method

This commit is contained in:
Nikolaus Gullotta 2019-09-12 14:01:55 -05:00 committed by Nikolaus Gullotta
parent bb0d10c2d4
commit a6323e84f6
No known key found for this signature in database
GPG key ID: 565F60578092AA31

View file

@ -225,11 +225,11 @@ bool MixerSnapshotManager::rename(MixerSnapshot* snapshot, const string& new_nam
const string dir = Glib::path_get_dirname(path);
if (move(snapshot, dir)) {
RenamedSnapshot(); /* EMIT SIGNAL */
RenamedSnapshot(); /* EMIT SIGNAL */
::g_remove(path.c_str());
//remove the old file
return true;
}
return true;
}
return false;
}
@ -240,26 +240,15 @@ bool MixerSnapshotManager::remove(MixerSnapshot* snapshot) {
}
const string path = snapshot->get_path();
const string dir = Glib::path_get_dirname(path);
::g_remove(path.c_str());
set<MixerSnapshot*>::iterator iter;
if(dir == _global_path) {
iter = _global_snapshots.find(snapshot);
if(iter != _global_snapshots.end()) {
delete (*iter);
_global_snapshots.erase(iter);
}
} else if(dir == _local_path) {
iter = _local_snapshots.find(snapshot);
if(iter != _local_snapshots.end()) {
delete (*iter);
_local_snapshots.erase(iter);
if (Glib::file_test(path.c_str(), Glib::FILE_TEST_EXISTS)) {
if(erase(snapshot)) {
::g_remove(path.c_str());
RemovedSnapshot(); /* EMIT SIGNAL */
return true;
}
}
RemovedSnapshot(); /* EMIT SIGNAL */
return true;
return false;
}
MixerSnapshot* MixerSnapshotManager::get_snapshot_by_name(const string& name, bool global)