@@ -53,18 +53,22 @@ 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 
56+ def  get_ac_path (view ,  pckgset ):
57+ 	""" Returns a path to a certain Archicad version, either from project file or  the global settings . 
58+ 		(Former is useful  if one is developing for different Archicad versions and 
5959		they want to use the appropiate LP Converter version.) 
6060	""" 
6161	project_data  =  view .window ().project_data ()
62- 	app_path  =  project_data .get ('AC_path' , "" )
63- 	return  app_path 
62+ 	proj_ac_path  =  project_data .get ('AC_path' , "" )
63+ 	if  not  proj_ac_path :
64+ 		ac_path  =  str (pckgset .get ("AC_path" , DEFAULT_AC_PATH ))
65+ 	else :
66+ 		ac_path  =  proj_ac_path 
67+ 	return  ac_path 
6468
6569def  err (text ):
6670	""" Gives us a ST error message. """ 
67- 	if  text   ==   None : 
71+ 	if  not   text :   #  None or empty 
6872		text  =  "Sorry. Something went wrong." 
6973	sublime .error_message (text )
7074
@@ -120,11 +124,7 @@ def run(self, *args, **kwargs):
120124		self .pckg_settings  =  sublime .load_settings (PACKAGE_SETTINGS )
121125
122126		# 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 
127+ 		self .AC_path  =  get_ac_path (self .view , self .pckg_settings )
128128
129129		self .lp_conv_path  =  self .check_system ()
130130		self .converter  =  os .path .join (self .AC_path , self .lp_conv_path )
0 commit comments