X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fsearch_paths.cc;h=8ee1dbc150dbe5f4767ad602f82b89d4e845ac9b;hb=7eb2d1d16de5d52175485bdd1a6acc53019fdb22;hp=85eed77a57535b26c1694672259040b9763423e2;hpb=40764f4cb31977da9e65e9e62135f21f7c508047;p=ardour.git diff --git a/libs/ardour/search_paths.cc b/libs/ardour/search_paths.cc index 85eed77a57..8ee1dbc150 100644 --- a/libs/ardour/search_paths.cc +++ b/libs/ardour/search_paths.cc @@ -1,6 +1,6 @@ /* - Copyright (C) 2011 Tim Mayberry - Copyright (C) 2013 Paul Davis + Copyright (C) 2011 Tim Mayberry + Copyright (C) 2013 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -64,7 +64,7 @@ control_protocol_search_path () Searchpath spath(user_config_directory ()); spath += ardour_dll_directory (); spath.add_subdirectory_to_paths (surfaces_dir_name); - + spath += Searchpath(Glib::getenv(surfaces_env_variable_name)); return spath; } @@ -163,14 +163,23 @@ route_template_search_path () return spath; } +Searchpath +lua_search_path () +{ + Searchpath spath (ardour_data_search_path()); + spath.add_subdirectory_to_paths(lua_dir_name); + + return spath; +} + #ifdef PLATFORM_WINDOWS const char* vst_search_path () { - DWORD dwType = REG_SZ; + DWORD dwType = REG_SZ; HKEY hKey; - DWORD dwSize = PATH_MAX; + DWORD dwSize = PATH_MAX; char* p = 0; char* user_home = 0; char tmp[PATH_MAX+1]; @@ -195,12 +204,13 @@ vst_search_path () } if (p == 0) { +#if ( (defined __i386__) || (defined _M_IX86) ) char *pVSTx86 = 0; - char *pProgFilesX86 = PBD::get_win_special_folder (CSIDL_PROGRAM_FILESX86); + std::string pProgFilesX86 = PBD::get_win_special_folder_path (CSIDL_PROGRAM_FILESX86); - if (pProgFilesX86) { + if (!pProgFilesX86.empty()) { // Look for a VST folder under C:\Program Files (x86) - if (pVSTx86 = g_build_filename (pProgFilesX86, "Steinberg", "VSTPlugins", NULL)) + if ((pVSTx86 = g_build_filename (pProgFilesX86.c_str(), "Steinberg", "VSTPlugins", NULL))) { if (Glib::file_test (pVSTx86, Glib::FILE_TEST_EXISTS)) if (Glib::file_test (pVSTx86, Glib::FILE_TEST_IS_DIR)) @@ -208,27 +218,22 @@ vst_search_path () g_free (pVSTx86); } - - g_free (pProgFilesX86); } - - if (p == 0) { - // Look for a VST folder under C:\Program Files - char *pVST = 0; - char *pProgFiles = PBD::get_win_special_folder (CSIDL_PROGRAM_FILES); - - if (pProgFiles) { - if (pVST = g_build_filename (pProgFiles, "Steinberg", "VSTPlugins", NULL)) { - if (Glib::file_test (pVST, Glib::FILE_TEST_EXISTS)) - if (Glib::file_test (pVST, Glib::FILE_TEST_IS_DIR)) - p = g_build_filename (pVST, NULL); - - g_free (pVST); - } - - g_free (pProgFiles); +#else + // Look for a VST folder under C:\Program Files + char *pVST = 0; + std::string pProgFiles = PBD::get_win_special_folder_path (CSIDL_PROGRAM_FILES); + + if (!pProgFiles.empty()) { + if ((pVST = g_build_filename (pProgFiles.c_str(), "Steinberg", "VSTPlugins", NULL))) { + if (Glib::file_test (pVST, Glib::FILE_TEST_EXISTS)) + if (Glib::file_test (pVST, Glib::FILE_TEST_IS_DIR)) + p = g_build_filename (pVST, NULL); + + g_free (pVST); } } +#endif } if (p == 0) { @@ -259,7 +264,7 @@ vst_search_path () return p; } -#else +#else /* Unix-like. Probably require some OS X specific breakdown if we ever add VST * support on that platform.