I’m working on a plugin that will dynamically add completions from any json
file with a .custom-completions
extension.
( implementation will be similar to the *_completions.py
plugins )
The issue I’m running into is that I need to get the absolute path of the custom-completions
files.
I’m attempting to use sublime.find_resources
to find all custom-completions
. Once they’re found, I need to convert them from relative to absolute paths so that I can run them through the json
module.
Here is the code I have so far:
import sublime
from os import path
customCompletion_Files = sublime.find_resources ( "*.custom-completions" )
file = path.abspath ( customCompletion_Files[0] )
print ( file )
The actual file I’m testing is:
Relative ( returned by "sublime.find_resources" ):
Packages\CustomCompletions\Completion Files\CSS.custom-completions
Absolute:
C:\Users\Fico\AppData\Roaming\Sublime Text 3\Packages\CustomCompletions\Completion Files\CSS.custom-completions
Currently, print
is returning the relative path appended to some arbitrary directory:
C:\_GIT\ST_SlideNav\Packages\CustomCompletions\Completion Files\CSS.custom-completions
If I reload SublimeText, the issue is persistent but the arbitrary directory will change.
Any ideas?