mirror of
https://github.com/zhigang1992/AutoFileName.git
synced 2026-01-12 22:45:57 +08:00
Fix for windows (I hope...)
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user