sublime_lib icon indicating copy to clipboard operation
sublime_lib copied to clipboard

Like ResourcePath.from_file_path, but accounting for symlinks.

Open Thom1729 opened this issue 6 years ago • 1 comments

Several packages, including PackageDev and AutomaticPackageReloader, try to determine the resource path of a file path supplied via view.file_name() or some other “external” source. ResourcePath.from_file_path can't do this reliably because it only looks at the syntax of the path, so that if the argument is a path elsewhere in the filesystem that's symlinked under Packages, then ResourcePath.from_file_path won't find it.

It might be convenient to provide a function to reliably return all resource paths that point to the same file as a given file path. (There may be more than one such resource path.) I don't think there's any faster way than to stat every resource file, which could be slow, but hopefully not disruptively slow if used sparingly.

Thom1729 avatar Feb 25 '19 04:02 Thom1729

I'd be interested in some benchmarks here tbh.

FichteFoll avatar Feb 25 '19 19:02 FichteFoll