I’m working on an autocomplete plugin, and am in the process of implementing file-specific completions.
A small issue I noticed is that sublime.find_resources
returns a path that does not use os.sep
( side note: is there any reason for this? )
I know I could easily replace all instances of /
with os.sep
, but am wondering if sublime.find_resources
returns the same output on non-windows operating systems.
If it does, I can simply implement the previously mentioned method.
If it doesn’t, I would just need to know what separator characters to use for each OS so I can replace them appropriately.
matchTest
:
matchFile = sublime.find_resources( "TEST.custom-completions" )[0]
currentFile = view.file_name()
print ( "matchFile = " + matchFile )
print ( "currentFile = " + currentFile )
if currentFile.endswith ( matchFile ):
print ( "match = TRUE" )
else:
print ( "match = FALSE" )
print ( "os.sep = " + os.sep )
Results
:
matchFile = Packages/CustomCompletions/Completion Files/TEST.custom-completions
currentFile = C:\Users\Fico\AppData\Roaming\Sublime Text 3\Packages\CustomCompletions\Completion Files\TEST.custom-completions
match = FALSE
os.sep = \