Like ResourcePath.from_file_path, but accounting for symlinks.

Open
#115 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
tooling

Research direction

Start by reading ResourcePath.from_file_path and the callers identified in the issue, including PackageDev and AutomaticPackageReloader. Define the new lookup's behavior around symlinked external paths and multiple matching resource paths, then verify that it returns every resource path pointing to the same file without disrupting infrequent use.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
56
Forks
4
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SublimeText/sublime_lib

All issues in SublimeText/sublime_lib

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.