Closed totalgee closed 6 years ago
There is a simple solution to this (I think); just fix the regex used by Quarks.findAbsolutePath
. The Windows case for Quarks.regex.isAbsolutePath
should be changed from
isAbsolutePath: "^[A-Za-z]:\\\\"
to
isAbsolutePath: "^[A-Za-z]:(?:\\\\|/)"
i.e. Allow back- or forward-slashes at the start of an absolute path, after the drive letter.
Workaround for now:
Quarks.install("myQuark".resolveRelative.tr($/, Platform.pathSeparator))
Fixed in #3328. Thanks again!
I was trying to register a local Quark via code. (Works fine on Mac.) The Quark is defined in a subdirectory of the currently-executing file. The code does this:
Quarks.install("myQuark".resolveRelative);
(obviously, it should also work with just
Quarks.install("myQuark")
if "myQuark" is not a registered Quark name, but in the end it performs the equivalent of resolveRelative to try to locate the Quark -- so you get the same failure in both cases)This produces an error, because
String.resolveRelative
produces, on Windows, a path with forward slashes -- which should be fine... (Indeed"myQuark".resolveRelative.openOS
correctly opens a File Explorer with the sub-directory path.)An example... Assuming the running SC file is in
C:\Users\me\Documents\project
, then"myQuark".resolveRelative
from there returns:C:/Users/me/Documents/project\myQuark
.If we call
Quarks.asAbsolutePath("myQuark".resolveRelative)
on that result (which is whatQuarks.install("myQuark")
does), there are no regex matches, so instead it concatenates the current path with the passed path (which already is absolute), and it returns this mess:C:/Users/me/Documents/project\C:/Users/me/Documents/project\myQuark
And of course it can't install the Quark from that path!