libsaria: Remove paths from library
If the user no longer wishes to track a certain path, they can remove it from the library. Note: it is unsafe to remove a path from the library while that path is being scanned. This could potentially lead to a segmentation fault.
This commit is contained in:
parent
2c12cb80aa
commit
245157c6b4
|
@ -22,6 +22,7 @@ namespace libsaria
|
|||
void refresh();
|
||||
|
||||
void add_path(string);
|
||||
void remove_path(string);
|
||||
void play_id(ino_t);
|
||||
void for_each(void (*)(Track &));
|
||||
void for_each_path(void (*)(struct PathInfo &));
|
||||
|
|
|
@ -129,4 +129,15 @@ namespace libsaria
|
|||
update_path(dir);
|
||||
}
|
||||
|
||||
void library::remove_path(string dir)
|
||||
{
|
||||
map<string, LibraryPath>::iterator it;
|
||||
it = get_library_map()->find(dir);
|
||||
if (it != get_library_map()->end()) {
|
||||
get_library_map()->erase(it);
|
||||
save();
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
|
||||
}; /* Namespace: libsaria */
|
||||
|
|
Loading…
Reference in New Issue