From 53a6b74b7f5e57405875a14b1ea68cbe55ebc44a Mon Sep 17 00:00:00 2001 From: Matt Seymour Date: Mon, 21 Dec 2015 22:24:20 +0000 Subject: [PATCH] Fix #136 - main_file setting and relative paths It should be assumed relative paths are from project path else having focus on another window will cause builds to fail / error One solution to this issue is to use absolute paths which is not very useful in team projects. --- lesscompiler.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lesscompiler.py b/lesscompiler.py index 5cc1846..079cbaf 100644 --- a/lesscompiler.py +++ b/lesscompiler.py @@ -134,10 +134,13 @@ def convert_one(self, is_auto_save=False): # if you've set the main_file (relative to current file), only that file # gets compiled this allows you to have one file with lots of @imports if self.settings['main_file']: - self.file_name = os.path.join( - os.path.dirname(self.file_name), - self.settings['main_file'] - ) + if not os.path.isabs(self.settings['main_file']): + self.file_name = os.path.abspath( + os.path.join( + dirs['project'], + self.settings['main_file'] + ) + ) # compile the LESS file return self.convertLess2Css(