lv2 fixes, dcraw upgrade, arch/libdv
[goodguy/history.git] / cinelerra-5.1 / cinelerra / mwindow.C
index 79ce0e3b53b4a7ddbbaa37a53caa35ee3be2a278..9de65dba075855f78b5c4aa1234f471cbb4350d1 100644 (file)
@@ -881,10 +881,25 @@ int MWindow::plugin_exists(char *plugin_path)
        return !plugindb ? 0 : plugin_exists(plugin_path, *plugindb);
 }
 
+void MWindow::remove_plugin_index()
+{
+       char index_path[BCTEXTLEN];
+       MWindow::create_defaults_path(index_path, PLUGIN_FILE);
+       ::remove(index_path);
+}
+
 void MWindow::init_preferences()
 {
        preferences = new Preferences;
        preferences->load_defaults(defaults);
+       const char *lv2_path = getenv("LV2_PATH");
+       if( lv2_path && strcmp(lv2_path, preferences->lv2_path) ) {
+               strncpy(preferences->lv2_path, lv2_path, sizeof(preferences->lv2_path));
+               remove_plugin_index();
+       }
+       else if( !lv2_path && preferences->lv2_path[0] ) {
+               File::setenv_path("LV2_PATH",preferences->lv2_path, 0);
+       }
        session = new MainSession(this);
        session->load_defaults(defaults);
        // set x11_host, screens, window_config