1010
1111PACKAGE_SETTINGS = "GDL.sublime-settings"
1212DEFAULT_AC_PATH = "C:/Program Files/GRAPHISOFT/ARCHICAD 23"
13+ DEFAULT_AC_PATH_MAC = "/Applications/GRAPHISOFT/AC23/ARCHICAD 23.app"
1314
1415def save_all_files ():
1516 """ Saves all files open in Sublime.
@@ -20,6 +21,21 @@ def save_all_files():
2021 if view .file_name () and view .is_dirty ():
2122 view .run_command ("save" )
2223
24+ def get_project_settings (view , request , * args ):
25+ """ Returns the requested parameters from the `.sublime-project` file.
26+ If the the very parameter does not exist this method return an empty string.
27+ TODO: migrate all other functions to this one
28+ """
29+ project_data = view .window ().project_data ()
30+
31+ if not project_data :
32+ err ("You must create a project first! (Project > Save Project As...)" )
33+ return
34+
35+ project_settings = project_data .get (request , "" )
36+
37+ return project_settings
38+
2339def get_project_data (view , invoke ):
2440 """ Gets the data of the .sublime-project file.
2541 Returns additional arguments for the commandline operation,
@@ -58,12 +74,13 @@ def get_ac_path(view, pckgset):
5874 (Former is useful if one is developing for different Archicad versions and
5975 they want to use the appropiate LP Converter version.)
6076 """
61- project_data = view . window (). project_data ( )
62- proj_ac_path = project_data . get ( 'AC_path' , "" )
77+ proj_ac_path = get_project_settings ( view , "AC_path" )
78+
6379 if not proj_ac_path :
6480 ac_path = str (pckgset .get ("AC_path" , DEFAULT_AC_PATH ))
6581 else :
6682 ac_path = proj_ac_path
83+
6784 return ac_path
6885
6986def err (text ):
0 commit comments