Skip to content

Commit

Permalink
overwrite AC_path in project file
Browse files Browse the repository at this point in the history
  • Loading branch information
runxel committed May 6, 2020
1 parent 91379c0 commit 0b088b2
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions GDL.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ def get_project_subroot(view):
sub_root_setting = project_data.get('root', "")
return sub_root_setting

def get_project_app_path(view):
""" Returns a path to a certain Archicad version, if set in the project file.
(Useful if one is developing for different Archicad versions and
they want to use the appropiate LP Converter version.)
"""
project_data = view.window().project_data()
app_path = project_data.get('AC_path', "")
return app_path

def err(text):
""" Gives us a ST error message. """
if text == None:
Expand Down Expand Up @@ -107,12 +116,19 @@ def on_post_save_async(self, view):
############################################################################
class Builder(sublime_plugin.WindowCommand):
def run(self, *args, **kwargs):
self.lp_conv_path = self.check_system()
self.view = self.window.active_view()
self.pckg_settings = sublime.load_settings(PACKAGE_SETTINGS)
self.AC_path = str(self.pckg_settings.get("AC_path", DEFAULT_AC_PATH))

# get the path to the LP_XML_Converter right
project_app_path = get_project_app_path(self.view)
if project_app_path == None:
self.AC_path = str(self.pckg_settings.get("AC_path", DEFAULT_AC_PATH))
else:
self.AC_path = project_app_path

self.lp_conv_path = self.check_system()
self.converter = os.path.join(self.AC_path, self.lp_conv_path)

self.view = self.window.active_view()
if self.view.settings().get("auto_save", True):
save_all_files()

Expand Down

0 comments on commit 0b088b2

Please sign in to comment.