diff --git a/ReaClassical/ReaClassical_Updater.lua b/ReaClassical/ReaClassical_Updater.lua index a3effcee..28fc5e2b 100644 --- a/ReaClassical/ReaClassical_Updater.lua +++ b/ReaClassical/ReaClassical_Updater.lua @@ -20,13 +20,14 @@ along with this program. If not, see . for key in pairs(reaper) do _G[key] = reaper[key] end -local main, copy_file, get_path +local main, copy_file, get_path, portable_check --------------------------------------------------------------------- function main() local separator = package.config:sub(1, 1) local resource_path = GetResourcePath() + local menu_relative_path = get_path("", "Scripts", "chmaha Scripts", "ReaClassical", "ReaClassical-menu.ini") local source_file_path = resource_path .. menu_relative_path local destination_file_path = resource_path .. separator .. "reaper-menu.ini" @@ -34,6 +35,13 @@ function main() local source_shortcuts_path = resource_path .. kb_relative_path local dest_shortcuts_path = resource_path .. separator .. "reaper-kb.ini" + local exist = portable_check(resource_path) + if not exist then + ShowMessageBox("The ReaClassical Updater can only be run on a ReaClassical Portable Install!" + .. "\nTo update just the functions in a regular REAPER install, please sync ReaPack.", "ReaClassical Updater", 0) + return + end + local sync_reapack = reaper.NamedCommandLookup("_REAPACK_SYNC") Main_OnCommand(sync_reapack, 0) ShowMessageBox("1) Syncing ReaPack repos. Please wait for this to complete before pressing OK.", @@ -107,4 +115,18 @@ end --------------------------------------------------------------------- +function portable_check(resource_path) + local status = false + local portable = resource_path .. get_path("", "rc_portable") + local destination_file_exists = io.open(portable, "rb") + if destination_file_exists then + destination_file_exists:close() + status = true + end + + return status +end + +--------------------------------------------------------------------- + main()