dart-sass icon indicating copy to clipboard operation
dart-sass copied to clipboard

Properly support UNC paths on the command line

Open dnaka91 opened this issue 4 years ago • 5 comments

As a new feature of the project trunk we auto-download dart-sass to the local device and then execute it as one of our pipelines. Before we used a directly compiled library that integrates with libsass but as that's deprecated we want to move to dart-sass.

In Rust, paths are quickly turned into UNC paths like \\?\C:\Users\Me\... through stdlib logic. We try to turn them back into the legacy-style C:\Users\Me\... paths but that may not always work due to path length limits and so on.

Therefore, it would be great if dart-sass could support UNC paths for input/output files.

dnaka91 avatar Mar 13 '21 03:03 dnaka91

Sass operates on URLs, not on paths, so we don't plan to add support for any OS-specific paths. If you're converting paths into another format anyway, should you instead convert to a file URL.

jathak avatar Mar 15 '21 20:03 jathak

I tried out using dart-sass with file URLs now and they don't work neither. Just to clarify, I'm talking about paths to files in the terminal that are passed to dart-sass and not import statements or anything alike.

So I added a conversion step before calling dart-sass, now passing file:///.... instead and that works neither on UNIX nor Windows systems. It fails with Duplicate source "file". similar to the problem with UNC paths.

dnaka91 avatar Mar 18 '21 03:03 dnaka91

I think the actual problem is the <input>:<output> syntax so it misunderstands anything with a colon as this mapping.

dnaka91 avatar Mar 18 '21 08:03 dnaka91

Ah, I see. I misread this as an issue with using the API, not the command line. OS paths passed on the command line should indeed be converted to URLs, so I'll reopen this, targeted to fixing that for UNC paths

jathak avatar Mar 18 '21 20:03 jathak

Dart's path package currently does not support the \\?\ prefix for UNC paths. I've filed a bug with the path repo here: https://github.com/dart-lang/path/issues/106.

Awjin avatar Mar 19 '21 18:03 Awjin