diff options
| author | Arun Isaac | 2026-07-01 14:35:02 +0100 |
|---|---|---|
| committer | Arun Isaac | 2026-07-01 23:14:41 +0100 |
| commit | 3e7eb08448ab76cfee6b7f561a3837631a386d6a (patch) | |
| tree | bf5517d590fa3dd413d1acfeef241f0a22dbc79c | |
| parent | 3e08dff9ba19a46c61e1b0782834865b5cc4c31f (diff) | |
| download | ccwl-3e7eb08448ab76cfee6b7f561a3837631a386d6a.tar.gz ccwl-3e7eb08448ab76cfee6b7f561a3837631a386d6a.tar.lz ccwl-3e7eb08448ab76cfee6b7f561a3837631a386d6a.zip | |
lang: Resolve relative paths instead of changing directory.
| -rw-r--r-- | ccwl/lang.scm | 19 |
1 files 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}." |
