Skip to content

Commit 3d42003

Browse files
committed
now uses absolute paths
1 parent e43bb4a commit 3d42003

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

GDL.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def run(self, *args, **kwargs):
9292
if len(self.folders) == 1:
9393
self.multipleFolders = False
9494
self.project_folder = self.folders[0]
95-
self.on_done_proj() # go on here
95+
self.delegator()
9696
else:
9797
self.multipleFolders = True
9898
self.pick_project_folder(self.folders)
@@ -135,13 +135,23 @@ def select_project(self, select):
135135
if select < 0: # will be -1 if panel was cancelled
136136
return
137137
self.project_folder = os.path.join(self.nr_path, folders[select])
138-
self.on_done_proj() # go on here
138+
self.delegator() # go on here
139139

140140
def show_quick_panel(self, options, done):
141141
""" Shows the Sublime Text quick panel with the invoked options. """
142142
# Sublime Text 3 requires a short timeout between quick panels
143143
sublime.set_timeout(lambda: self.window.show_quick_panel(options, done), 10)
144144

145+
def delegator(self):
146+
""" Delegates back to the specific calling class.
147+
Also makes the `project_folder` path absolut.
148+
"""
149+
# make absolut path, since relative paths might introduce errors
150+
self.project_folder = os.path.join(self.project_path_abs_root, self.project_folder)
151+
152+
# this delegates back to the calling class.
153+
self.on_done_proj()
154+
145155

146156
# @classmethod
147157
# def is_enabled(self):
@@ -159,12 +169,13 @@ def run(self, *args, **kwargs):
159169
super().run(self)
160170

161171
def on_done_proj(self):
162-
# we're coming from super()
172+
# we're coming from super().delegator()
163173
# own function because quick panel is async
164174
self.find_gsm()
165175

166176
def find_gsm(self):
167177
self.files = []
178+
log.debug(self.project_folder)
168179
# r=root, d=directories, f=files
169180
for r, d, f in os.walk(self.project_folder):
170181
for file in f:
@@ -192,6 +203,7 @@ def select_gsm(self, select):
192203
def run_hsf(self, ):
193204
""" Invokes the LP_XML converter.
194205
"""
206+
# normpath all to just be sure the CLI will take them without complain
195207
self.converter = super().normpath(self.converter)
196208
self.file_to_convert = super().normpath(self.file_to_convert)
197209
self.project_folder = super().normpath(self.project_folder)
@@ -214,6 +226,7 @@ def run(self, *args, **kwargs):
214226
super().run(self)
215227

216228
def on_done_proj(self):
229+
# we're coming from super().delegator()
217230
# own function because quick panel is async
218231
self.find_hsf()
219232

0 commit comments

Comments
 (0)