Skip to content

Commit 0423f13

Browse files
committed
Problems with new 'root' feature fixed
- there was a problem on converting to HSF with the new 'root' feature when there was no root set in the *.sublime-project file - there was another issue which lead to not finding any GSMs to convert
1 parent 738b464 commit 0423f13

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

GDL.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,17 @@ def run(self, *args, **kwargs):
7171
self.AC_path = str(self.pckg_settings.get("AC_path", DEFAULT_AC_PATH))
7272
self.converter = os.path.join(self.AC_path, self.lp_conv_path)
7373

74+
self.project_path_abs_root = self.window.folders()[0]
75+
7476
self.view = self.window.active_view()
7577
if self.view.settings().get("auto_save", True):
7678
save_all_files()
7779

7880
self.nr_path = get_project_newroot(self.view)
7981
log.debug(self.nr_path)
8082
# see if there is a relative path set in the project settings
81-
if self.nr_path != "":
82-
nr_path_abs = os.path.join(self.window.folders()[0], self.nr_path)
83+
if self.nr_path != None: # empty path is of type 'None'
84+
nr_path_abs = os.path.join(self.project_path_abs_root, self.nr_path)
8385
self.folders = [directory for directory in os.listdir(nr_path_abs) if os.path.isdir(os.path.join(nr_path_abs, directory))]
8486
else:
8587
self.folders = self.window.folders()
@@ -109,6 +111,9 @@ def check_system(self):
109111
return
110112

111113
def normpath(self, path):
114+
""" Normalize a pathname by collapsing redundant separators.
115+
On Windows, it converts forward slashes to backward slashes.
116+
"""
112117
return '"{}"'.format(os.path.normpath(path))
113118

114119
def pick_project_folder(self, folders):
@@ -126,11 +131,10 @@ def pick_project_folder(self, folders):
126131
self.show_quick_panel(folderNames, self.select_project)
127132

128133
def select_project(self, select):
129-
#folders = self.window.folders()
130134
folders = self.folders
131135
if select < 0: # will be -1 if panel was cancelled
132136
return
133-
self.project_folder = folders[select]
137+
self.project_folder = os.path.join(self.nr_path, folders[select])
134138
self.on_done_proj() # go on here
135139

136140
def show_quick_panel(self, options, done):
@@ -155,6 +159,7 @@ def run(self, *args, **kwargs):
155159
super().run(self)
156160

157161
def on_done_proj(self):
162+
# we're coming from super()
158163
# own function because quick panel is async
159164
self.find_gsm()
160165

@@ -168,8 +173,7 @@ def find_gsm(self):
168173

169174
if len(self.files) <= 0:
170175
sublime.error_message("GDL build error: No GSM found.")
171-
172-
if len(self.files) > 1:
176+
elif len(self.files) > 1:
173177
self.show_quick_panel(self.files, self.select_gsm)
174178
else:
175179
self.file_to_convert = self.files[0]

0 commit comments

Comments
 (0)