Fix for windows (I hope...)

This commit is contained in:
Liam Cain
2012-01-21 20:04:41 -05:00
parent 0ad2b55f50
commit a75dcba2d7

View File

@@ -6,7 +6,7 @@ class FileNameComplete(sublime_plugin.EventListener):
completions = []
sel = view.sel()[0].a
if "/" in view.substr(sublime.Region(sel-2,sel)):
if os.path.sep in view.substr(sublime.Region(sel-2,sel)):
if "string" in view.scope_name(sel):
pass
elif "css" in view.scope_name(sel):
@@ -16,20 +16,20 @@ class FileNameComplete(sublime_plugin.EventListener):
else:
return []
this_dir = os.path.split(view.file_name())[0] + "/"
this_dir = os.path.split(view.file_name())[0] + os.path.sep
cur_path = view.substr(view.extract_scope(sel-1))
if cur_path.startswith(("'","\"")):
cur_path = cur_path[1:-1]
this_dir += cur_path
this_dir = os.path.join(this_dir, cur_path)
try:
dir_files = os.listdir(this_dir)
for d in dir_files:
if not '.' in d:
d += '/'
d += os.path.sep
completions.append(d.decode('utf-8'))
return [(x, x) for x in list(set(completions))]
except OSError: