@@ -173,8 +173,9 @@ def build(config, filter, dry_run, watch, verbose):
173
173
"""
174
174
Generate API docs based on the given configuration file (`./_quarto.yml` by default).
175
175
"""
176
- cfg_path = f"{ os .getcwd ()} /{ config } "
177
- if not Path (cfg_path ).exists ():
176
+
177
+ cfg_path = Path (config ).absolute ()
178
+ if not cfg_path .exists ():
178
179
raise FileNotFoundError (
179
180
f"Configuration file { cfg_path } not found. Please create one."
180
181
)
@@ -191,25 +192,26 @@ def build(config, filter, dry_run, watch, verbose):
191
192
if dry_run :
192
193
pass
193
194
else :
194
- if watch :
195
- pkg_path = get_package_path (builder .package )
196
- print (f"Watching { pkg_path } for changes..." )
197
- observer = Observer ()
198
- observer ._event_queue .maxsize = 1 # the default is 0 which is infinite, and there isn't a way to set this in the constructor
199
- event_handler = QuartoDocFileChangeHandler (callback = doc_build )
200
- observer .schedule (event_handler , pkg_path , recursive = True )
201
- observer .schedule (event_handler , cfg_path , recursive = True )
202
- observer .start ()
203
- try :
204
- while True :
205
- time .sleep (1 )
206
- except KeyboardInterrupt :
207
- pass
208
- finally :
209
- observer .stop ()
210
- observer .join ()
211
- else :
212
- doc_build ()
195
+ with chdir (Path (config ).parent ):
196
+ if watch :
197
+ pkg_path = get_package_path (builder .package )
198
+ print (f"Watching { pkg_path } for changes..." )
199
+ observer = Observer ()
200
+ observer ._event_queue .maxsize = 1 # the default is 0 which is infinite, and there isn't a way to set this in the constructor
201
+ event_handler = QuartoDocFileChangeHandler (callback = doc_build )
202
+ observer .schedule (event_handler , pkg_path , recursive = True )
203
+ observer .schedule (event_handler , cfg_path , recursive = True )
204
+ observer .start ()
205
+ try :
206
+ while True :
207
+ time .sleep (1 )
208
+ except KeyboardInterrupt :
209
+ pass
210
+ finally :
211
+ observer .stop ()
212
+ observer .join ()
213
+ else :
214
+ doc_build ()
213
215
214
216
215
217
@click .command (
0 commit comments