summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorNikolaus Gullotta <nikolaus.gullotta@gmail.com>2018-08-01 14:42:02 -0500
committerNikolaus Gullotta <nikolaus.gullotta@gmail.com>2018-08-01 14:42:02 -0500
commitb45c7089c638202ab20dfbacf06b5a6f408509da (patch)
tree38aa23f8ca02063aab45123c9d7958bc28abc5c1 /scripts
parentd77aa4e3a5bfa729ac629a7a09def9ba04acb2a5 (diff)
implement fetch_valid_settings_file() to avoid the user having to see stub files
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mixer_settings_recall.lua19
1 files changed, 16 insertions, 3 deletions
diff --git a/scripts/mixer_settings_recall.lua b/scripts/mixer_settings_recall.lua
index f8e22276dd..af07256b4c 100644
--- a/scripts/mixer_settings_recall.lua
+++ b/scripts/mixer_settings_recall.lua
@@ -47,6 +47,19 @@ function factory () return function ()
return exists(path.."/")
end
+ function fetch_valid_settings_file(directory, fallback)
+ local i, t, popen = 0, {}, io.popen
+ local pfile = popen('ls "'..directory..'"')
+ for filename in pfile:lines() do
+ i = i + 1
+ if string.find(filename, ".lua") then
+ return filename
+ end
+ end
+ pfile:close()
+ return fallback
+ end
+
function get_processor_by_name(track, name)
local i = 0
local proc = track:nth_processor(i)
@@ -377,7 +390,7 @@ function factory () return function ()
else
if gvld['recall-dir'] == 1 then
local global_ok = isdir(global_path)
- local global_default_path = ARDOUR.LuaAPI.build_filename(global_path, string.format("FactoryDefault-%s.lua", whoami()))
+ local global_default_path = ARDOUR.LuaAPI.build_filename(global_path, fetch_valid_settings_file(global_path, string.format("FactoryDefault-%s.lua", whoami())))
print(global_default_path)
if global_ok then
recall_options[2]['path'] = global_default_path
@@ -398,10 +411,10 @@ function factory () return function ()
if gvld['recall-dir'] == 2 then
local local_ok = isdir(local_path)
- local local_default_path = ARDOUR.LuaAPI.build_filename(local_path, 'stub')
+ local local_default_path = ARDOUR.LuaAPI.build_filename(local_path, fetch_valid_settings_file(local_path))
print(local_default_path)
if local_ok then
- recall_options[2]['path'] = local_path
+ recall_options[2]['path'] = local_default_path
local rv = LuaDialog.Dialog("Recall Mixer Settings:", recall_options):run()
if not(rv) then return end
local dry_return = LuaDialog.Dialog("Mixer Store:", dry_run(false, rv['file'])):run()