Skip to content

Commit 0b088b2

Browse files
committed
overwrite AC_path in project file
1 parent 91379c0 commit 0b088b2

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

GDL.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ def get_project_subroot(view):
5353
sub_root_setting = project_data.get('root', "")
5454
return sub_root_setting
5555

56+
def get_project_app_path(view):
57+
""" Returns a path to a certain Archicad version, if set in the project file.
58+
(Useful if one is developing for different Archicad versions and
59+
they want to use the appropiate LP Converter version.)
60+
"""
61+
project_data = view.window().project_data()
62+
app_path = project_data.get('AC_path', "")
63+
return app_path
64+
5665
def err(text):
5766
""" Gives us a ST error message. """
5867
if text == None:
@@ -107,12 +116,19 @@ def on_post_save_async(self, view):
107116
############################################################################
108117
class Builder(sublime_plugin.WindowCommand):
109118
def run(self, *args, **kwargs):
110-
self.lp_conv_path = self.check_system()
119+
self.view = self.window.active_view()
111120
self.pckg_settings = sublime.load_settings(PACKAGE_SETTINGS)
112-
self.AC_path = str(self.pckg_settings.get("AC_path", DEFAULT_AC_PATH))
121+
122+
# get the path to the LP_XML_Converter right
123+
project_app_path = get_project_app_path(self.view)
124+
if project_app_path == None:
125+
self.AC_path = str(self.pckg_settings.get("AC_path", DEFAULT_AC_PATH))
126+
else:
127+
self.AC_path = project_app_path
128+
129+
self.lp_conv_path = self.check_system()
113130
self.converter = os.path.join(self.AC_path, self.lp_conv_path)
114131

115-
self.view = self.window.active_view()
116132
if self.view.settings().get("auto_save", True):
117133
save_all_files()
118134

0 commit comments

Comments
 (0)