Skip to content

Commit 9a27b62

Browse files
committed
ReaDashboard v1.0.6 - macOS fix
1 parent aa733d4 commit 9a27b62

1 file changed

Lines changed: 18 additions & 13 deletions

File tree

ReaDashboard/Anshul_ReaDashboard.lua

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- @description ReaDashboard
2-
-- @version 1.0.5
2+
-- @version 1.0.6
33
-- @author Anshul
44
-- @credits solger (for ReaLauncher concept)
55
-- @about
@@ -11,6 +11,9 @@
1111
-- - SWS Extensions
1212
-- @changelog
1313
--
14+
-- v1.0.6
15+
-- + Fixed a critical bug preventing Mac and Linux users from opening any projects due to Windows-specific path formatting.
16+
--
1417
-- v1.0.5
1518
-- + Fixed 'Last Opened' sorting order (now properly ordered newest to oldest)
1619
-- + Fixed search bar repeatedly losing keyboard focus while typing
@@ -1301,12 +1304,18 @@ local function CanonicalPath(p)
13011304
return np
13021305
end
13031306

1304-
--- Convert an internal (forward-slash) path to Windows backslash format for
1305-
--- handing off to REAPER APIs that write to REAPER.ini.
1306-
--- Only needed at the exact boundary where a path leaves the script and enters REAPER.
1307+
local IS_WIN = reaper.GetOS():match('Win') ~= nil
1308+
local IS_MAC = reaper.GetOS():match('OSX') ~= nil or reaper.GetOS():match('macOS') ~= nil
1309+
1310+
--- Convert an internal path to the native OS path format for
1311+
--- handing off to REAPER APIs (Main_openProject and REAPER.ini writes).
13071312
local function ReaperPath(p)
13081313
if not p then return p end
1309-
return CanonicalPath(p):gsub('/', '\\')
1314+
if IS_WIN then
1315+
return CanonicalPath(p):gsub('/', '\\')
1316+
else
1317+
return CanonicalPath(p):gsub('\\', '/')
1318+
end
13101319
end
13111320

13121321
-- ============================================================================
@@ -3387,14 +3396,10 @@ end
33873396

33883397
local function ActionLocateInExplorer(proj)
33893398
if not proj or not proj.exists then return end
3390-
local os_name = reaper.GetOS()
3391-
if os_name:match('OSX') or os_name:match('macOS') then
3392-
-- macOS: CF_LocateInExplorer works natively with forward-slash paths
3393-
reaper.CF_LocateInExplorer(proj.path)
3399+
if IS_WIN then
3400+
reaper.CF_LocateInExplorer(proj.path:gsub('/', '\\'))
33943401
else
3395-
-- Windows/Linux: CF_LocateInExplorer needs backslash paths on Windows
3396-
local winpath = proj.path:gsub('/', '\\')
3397-
reaper.CF_LocateInExplorer(winpath)
3402+
reaper.CF_LocateInExplorer(proj.path:gsub('\\', '/'))
33983403
end
33993404
end
34003405

@@ -4978,7 +4983,7 @@ local function DrawContextMenu(proj, idx)
49784983
if ImGui.Selectable(ctx, 'Open Project', false) then ActionOpenProject(proj) end
49794984
if ImGui.Selectable(ctx, 'Load in Tab', false) then ActionLoadInTab(proj) end
49804985
ImGui.Separator(ctx)
4981-
local locate_label = (reaper.GetOS():match('OSX') or reaper.GetOS():match('macOS')) and 'Reveal in Finder' or 'Locate in Explorer'
4986+
local locate_label = IS_MAC and 'Reveal in Finder' or 'Locate in Explorer'
49824987
if ImGui.Selectable(ctx, locate_label, false) then ActionLocateInExplorer(proj) end
49834988
end
49844989

0 commit comments

Comments
 (0)