@@ -105,10 +105,17 @@ def load_search_functions() -> Dict[str, LazySearchModule]:
105105 loaded_functions = {}
106106
107107 # Determine base path (calculated once)
108- base_path = os .path .join (
109- sys ._MEIPASS , "StreamingCommunity"
110- ) if getattr (sys , 'frozen' , False ) else os .path .dirname (os .path .dirname (__file__ ))
111- api_dir = os .path .join (base_path , 'Site' )
108+ if getattr (sys , 'frozen' , False ):
109+
110+ # When frozen (exe), sys._MEIPASS points to temporary extraction directory
111+ base_path = os .path .join (sys ._MEIPASS , "StreamingCommunity" )
112+ api_dir = os .path .join (base_path , 'Api' , 'Site' )
113+
114+ else :
115+ # When not frozen, __file__ is in StreamingCommunity/Api/Template/loader.py
116+ # Go up two levels to get to StreamingCommunity/Api
117+ base_path = os .path .dirname (os .path .dirname (__file__ ))
118+ api_dir = os .path .join (base_path , 'Site' )
112119
113120 # Quick scan: just read directory structure and module metadata
114121 modules_metadata = []
@@ -138,6 +145,7 @@ def load_search_functions() -> Dict[str, LazySearchModule]:
138145
139146 if indice is not None :
140147 modules_metadata .append ((module_name , indice ))
148+ logging .info (f"Found module: { module_name } (index: { indice } )" )
141149
142150 except Exception as e :
143151 console .print (f"[yellow]Warning: Could not read metadata from { module_name } : { str (e )} " )
@@ -146,4 +154,5 @@ def load_search_functions() -> Dict[str, LazySearchModule]:
146154 for module_name , indice in sorted (modules_metadata , key = lambda x : x [1 ]):
147155 loaded_functions [f'{ module_name } _search' ] = LazySearchModule (module_name , indice )
148156
157+ logging .info (f"Loaded { len (loaded_functions )} search modules" )
149158 return loaded_functions
0 commit comments