|
1 | 1 | -- @description ReaDashboard |
2 | | --- @version 1.0.5 |
| 2 | +-- @version 1.0.6 |
3 | 3 | -- @author Anshul |
4 | 4 | -- @credits solger (for ReaLauncher concept) |
5 | 5 | -- @about |
|
11 | 11 | -- - SWS Extensions |
12 | 12 | -- @changelog |
13 | 13 | -- |
| 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 | +-- |
14 | 17 | -- v1.0.5 |
15 | 18 | -- + Fixed 'Last Opened' sorting order (now properly ordered newest to oldest) |
16 | 19 | -- + Fixed search bar repeatedly losing keyboard focus while typing |
@@ -1301,12 +1304,18 @@ local function CanonicalPath(p) |
1301 | 1304 | return np |
1302 | 1305 | end |
1303 | 1306 |
|
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). |
1307 | 1312 | local function ReaperPath(p) |
1308 | 1313 | 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 |
1310 | 1319 | end |
1311 | 1320 |
|
1312 | 1321 | -- ============================================================================ |
@@ -3387,14 +3396,10 @@ end |
3387 | 3396 |
|
3388 | 3397 | local function ActionLocateInExplorer(proj) |
3389 | 3398 | 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('/', '\\')) |
3394 | 3401 | 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('\\', '/')) |
3398 | 3403 | end |
3399 | 3404 | end |
3400 | 3405 |
|
@@ -4978,7 +4983,7 @@ local function DrawContextMenu(proj, idx) |
4978 | 4983 | if ImGui.Selectable(ctx, 'Open Project', false) then ActionOpenProject(proj) end |
4979 | 4984 | if ImGui.Selectable(ctx, 'Load in Tab', false) then ActionLoadInTab(proj) end |
4980 | 4985 | 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' |
4982 | 4987 | if ImGui.Selectable(ctx, locate_label, false) then ActionLocateInExplorer(proj) end |
4983 | 4988 | end |
4984 | 4989 |
|
|
0 commit comments