Last active
December 14, 2015 22:39
-
-
Save xu-cheng/5160065 to your computer and use it in GitHub Desktop.
Handle Cygwin Path in Sublime
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
import sublime | |
cygwin_drive_regex = re.compile(r"^/cygdrive/([a-zA-Z])/") | |
def cygwin_path_handle(path): | |
"""Cygwin Path Support""" | |
if sublime.platform() == "windows": | |
return os.path.normcase(re.sub(cygwin_drive_regex, lambda m: "%s:/" % m.groups()[0], path)) | |
else: | |
return path # do nothing if it is not under windows. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could you tell me how to use this. I suppose this is exactly what I'm searching for, but I don't know how to use this code in sublime.