13
0

Try search-path when updating action scripts

When scripts are bundled the absolute path will
change with every version.
This commit is contained in:
Robin Gareus 2024-06-17 16:22:52 +02:00
parent 1e5a5b6b4f
commit c6c980c5a5
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -35,6 +35,7 @@
#include "ardour/filesystem_paths.h"
#include "ardour/plugin_manager.h"
#include "ardour/route.h"
#include "ardour/search_paths.h"
#include "ardour/session.h"
#include "ardour/system_exec.h"
@ -1207,11 +1208,16 @@ LuaInstance::~LuaInstance ()
}
static std::string
lua_read_script (std::string const& fn)
lua_read_script (std::string fn)
{
if (!UIConfiguration::instance().get_update_action_scripts ()) {
return "";
}
if (Glib::path_is_absolute (fn) && !Glib::file_test (fn, Glib::FILE_TEST_EXISTS | Glib::FILE_TEST_IS_REGULAR)) {
PBD::find_file (lua_search_path (), Glib::path_get_basename (fn), fn);
}
try {
return Glib::file_get_contents (fn);
} catch (...) { }