Skip to content
Open
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
14 changes: 12 additions & 2 deletions lesscompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ def convertLess2Css(self, lessc_command, dirs, file='', minimised=True, outputFi
if not lessc_command:
lessc_command = "lessc"

# by trying it on both OSX and Windows this seems to be the combination that works
if sys.version_info < (3, 0, 0) and platform.system() is 'Windows':
less = less.encode(sys.getfilesystemencoding())
css = css.encode(sys.getfilesystemencoding())

# get the name of the platform (ie are we running on windows)
platform_name = platform.system()
# check if the compiler should create a minified CSS file
Expand Down Expand Up @@ -240,8 +245,8 @@ def parseBaseDirs(self, base_dir='./', output_dir=''):
fn = self.view.file_name()
# in Python 3 all string are Unicode by default, we only have to encode when running on something lower than 3
# in addition Windows uses UTF-16 for its file names so we don't encode to UTF-8 on Windows
if sys.version_info < (3, 0, 0) and not platform.system() is "Windows":
fn = fn.encode("utf_8")
if sys.version_info < (3, 0, 0): # and not platform.system() is "Windows":
fn = fn.encode(sys.getfilesystemencoding())

# get the folder of the current file
file_dir = os.path.dirname(fn)
Expand Down Expand Up @@ -281,6 +286,11 @@ def parseBaseDirs(self, base_dir='./', output_dir=''):
proj_folders = window.folders()
# loop through all the top level folders in the project
for folder in proj_folders:
# there was a problem when fn contains a special char like é. An error would
# occur when checking if fn starts with the folder. Converting folder to utf_8
# seems to fix this error
if sys.version_info < (3, 0, 0): # and not platform.system() is 'Windows':
folder = folder.encode(sys.getfilesystemencoding())
# we will have found the project folder when it matches with the start of the current file name
if fn.startswith(folder):
# keep the current folder as the project folder
Expand Down