Avoid g_str_has_prefix() for local uri path checks
- g_str_has_prefix() call in widgets/rb-import-dialog.c:
@@ -431,7 +431,7 @@ current_folder_changed_cb (GtkFileChooser *chooser, RBImportDialog *dialog)
locations = g_settings_get_strv (settings, "locations");
gtk_widget_set_sensitive (dialog->priv->copy_check, TRUE);
for (i = 0; locations[i] != NULL; i++) {
if (g_str_has_prefix (uri, locations[i])) {
gtk_widget_set_sensitive (dialog->priv->copy_check, FALSE);
break;
}
This call currently succeeds with:
g_str_has_prefix("/home/crvi/Music.old", "/home/crvi/Music")
disabling the dialog->priv->copy_check
checkbox, which is incorrect.
- g_str_has_prefix() call in rhythmdb/rhythmdb-monitor.c:
@@ -280,7 +280,7 @@ rhythmdb_directory_change_cb (GFileMonitor *monitor,
/* ignore new files outside of the library locations */
for (i = 0; db->priv->library_locations[i] != NULL; i++) {
if (g_str_has_prefix (canon_uri, db->priv->library_locations[i])) {
in_library = TRUE;
break;
}
This call fails with
g_str_has_prefix("/home/crvi/Music/Artist/Album/file.mp3", "/home/crvi//Music")
due to '//' in prefix.