Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSL: support relative paths & change capital drive letter to lowercase #11

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.8
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: python

python:
- "3.4"
- "3.8"

install:
- "pip install flake8"
Expand Down
13 changes: 7 additions & 6 deletions linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,18 @@ def tmpfile(self, cmd, code, suffix=None):
for path in prjsrc:
if sublime.platform() == 'windows':
if wslopt:
path = '/mnt/' + re.sub(':', '', path)
path = '-I' + re.sub(re.compile(r'\\'), '/', path)
cmd.append(path)
path = re.sub(r'(^[a-zA-Z])(:)(.*$)',lambda m : f'/mnt/{m.group(1).lower()}{m.group(3)}',path)
path = re.sub(re.compile(r'\\'), '/', path)
path = '-I' + path
cmd.append(path)

with make_temp_file(suffix, code) as file:
ctx = get_view_context(self.view)
ctx['file_on_disk'] = self.filename
if sublime.platform() == 'windows':
if wslopt:
orig_file = file.name
file.name = '/mnt/' + re.sub(':', '', file.name)
file.name = re.sub(r'(^[a-zA-Z])(:)(.*$)',lambda m : f'/mnt/{m.group(1).lower()}{m.group(3)}',file.name)
file.name = re.sub(re.compile(r'\\'), '/', file.name)
ctx['temp_file'] = file.name
cmd.append(file.name)
Expand All @@ -195,8 +196,8 @@ def tmpfile(self, cmd, code, suffix=None):
if wslopt:
orig_file = file.name
orig_wrap = wrap.name
file.name = '/mnt/' + re.sub(':', '', file.name)
wrap.name = '/mnt/' + re.sub(':', '', wrap.name)
file.name = re.sub(r'(^[a-zA-Z])(:)(.*$)',lambda m : f'/mnt/{m.group(1).lower()}{m.group(3)}',file.name)
wrap.name = re.sub(r'(^[a-zA-Z])(:)(.*$)',lambda m : f'/mnt/{m.group(1).lower()}{m.group(3)}',wrap.name)
file.name = re.sub(re.compile(r'\\'), '/', file.name)
wrap.name = re.sub(re.compile(r'\\'), '/', wrap.name)
ctx['temp_file'] = file.name
Expand Down