randy3k / AutomaticPackageReloader

Automatically reload submodules while developing a Sublime Text package.
MIT License
38 stars 13 forks source link

relative_to_spp (and therefore reloading) doesn't work with symlinks #16

Closed timotheecour closed 6 years ago

timotheecour commented 6 years ago
def relative_to_spp(path):
    spp = sublime.packages_path()
    spp_real = casedpath(os.path.realpath(spp))
    for p in [path, casedpath(os.path.realpath(path))]:
        print(('spp_real:v1', spp_real, p))
        for sp in [spp, spp_real]:
            if p.startswith(sp + os.sep):
                return p[len(sp):]
    return None

prints:

('spp_real:v1', '/Users/timothee/git_clone/sublime_packages', '/Users/timothee/git_clone/AutomaticPackageReloader/package_reloader.py')

so relative_to_spp returns None

even though it shouldn't:

sublime.packages_path()
'/Users/timothee/Library/Application Support/Sublime Text 3/Packages'

realpath '/Users/timothee/Library/Application Support/Sublime Text 3/Packages'
/Users/timothee/git_clone/sublime_packages

ls /Users/timothee/git_clone/sublime_packages
AutomaticPackageReloader -> /Users/timothee/git_clone//AutomaticPackageReloader/