koko1000ban / SublimeGtags

GNU GLOBAL(gtags) support for Sublime Text 2/3
21 stars 19 forks source link

For Sublime Text Build 3114 x64, it cannot works!!!! #18

Open tianakack opened 8 years ago

tianakack commented 8 years ago

The ERROR information is:

TypeError: environment can only contain strings

I have found that path.encode('utf-8') causes this problem in the file D:...\Sublime Text\Data\Packages\SublimeGtags\gtags.py, it will convert the "F:/project" to b"F:/project":

class TagFile(object):
    def _expand_path(self, path):
        path = os.path.expandvars(os.path.expanduser(path))
        if IS_WINDOWS:
            path = path.encode('utf-8')
        return path

So, I added this If statement if int(sublime.version()) < 3000::

class TagFile(object):
    def _expand_path(self, path):
        path = os.path.expandvars(os.path.expanduser(path))
        if IS_WINDOWS:
            if int(sublime.version()) < 3000:
                path = path.encode('utf-8')
        return path

NOW, it works fine~!

kpld commented 6 years ago

Great work! Thanks tianjun9 to fix this bug.