catch duplicate shortcut folders.
authorRobin Gareus <robin@gareus.org>
Sun, 6 Sep 2015 16:15:48 +0000 (18:15 +0200)
committerRobin Gareus <robin@gareus.org>
Sun, 6 Sep 2015 16:15:48 +0000 (18:15 +0200)
gtk2_ardour/sfdb_ui.cc

index 3f1d93fb4ccd15bcc91966957194f550b7771f15..ed1cfd44ca6c68daa67589d49bccb0219ed61291 100644 (file)
@@ -560,10 +560,16 @@ SoundFileBrowser::SoundFileBrowser (string title, ARDOUR::Session* s, bool persi
 {
 
 #ifdef GTKOSX
-        chooser.add_shortcut_folder_uri("file:///Library/GarageBand/Apple Loops");
-        chooser.add_shortcut_folder_uri("file:///Library/Audio/Apple Loops");
-        chooser.add_shortcut_folder_uri("file:///Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files");
-        chooser.add_shortcut_folder_uri("file:///Volumes");
+       try {
+               /* add_shortcut_folder throws an exception if the folder being added already has a shortcut */
+               chooser.add_shortcut_folder_uri("file:///Library/GarageBand/Apple Loops");
+               chooser.add_shortcut_folder_uri("file:///Library/Audio/Apple Loops");
+               chooser.add_shortcut_folder_uri("file:///Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files");
+               chooser.add_shortcut_folder_uri("file:///Volumes");
+       }
+       catch (Glib::Error & e) {
+               std::cerr << "sfdb.add_shortcut_folder() threw Glib::Error " << e.what() << std::endl;
+       }
 #endif
 
        //add the file chooser