From 3e7eb08448ab76cfee6b7f561a3837631a386d6a Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 1 Jul 2026 14:35:02 +0100 Subject: lang: Resolve relative paths instead of changing directory. --- ccwl/lang.scm | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/ccwl/lang.scm b/ccwl/lang.scm index 1189287..b52a5ab 100644 --- a/ccwl/lang.scm +++ b/ccwl/lang.scm @@ -69,18 +69,13 @@ it." (define (ccwl-load-helper file file-syntax) "Load ccwl source @var{file}. @var{file-syntax} is the syntax object wrapping @var{file}." - (if (file-exists? file) - (let ((source-path (canonicalize-path file))) - ;; Change directory before loading source file. The source - ;; file may reference other files with paths relative to its - ;; directory. - (call-with-current-directory (dirname source-path) - (lambda () - (load source-path ccwl-read)))) - (raise-continuable - (condition (ccwl-violation file-syntax) - (formatted-message "File ~a does not exist" - file))))) + (let ((source-path (resolve-file-syntax file file-syntax))) + (if (file-exists? source-path) + (load source-path ccwl-read) + (raise-continuable + (condition (ccwl-violation file-syntax) + (formatted-message "File ~a does not exist" + file)))))) (define-syntax-rule (ccwl-load file) "Load ccwl source @var{file}." -- cgit 1.4.1