From 81e30b585b3c476968cbade91de5e6e4d136d9aa Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 27 Sep 2016 06:55:23 -0700 Subject: Change criterion for *load-path*-relative loading. * eval.c (load): Do not resolve all relative paths relative to the current *load-path*, only pure relative ones. * match.c (v_load): Likewise. * txr.1: Update doc for @(load)/@(include) and load function. --- eval.c | 2 +- match.c | 2 +- txr.1 | 12 ++++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/eval.c b/eval.c index 463eb7f5..263fa677 100644 --- a/eval.c +++ b/eval.c @@ -3347,7 +3347,7 @@ val load(val target) { uses_or2; val parent = or2(load_path, null_string); - val path = if3(abs_path_p(target), + val path = if3(!pure_rel_path_p(target), target, cat_str(nappend2(sub_list(split_str(parent, lit("/")), zero, negone), diff --git a/match.c b/match.c index f1c1dba4..85e44b82 100644 --- a/match.c +++ b/match.c @@ -3878,7 +3878,7 @@ static val v_load(match_files_ctx *c) sem_error(specline, lit("~s: null string path given"), sym, nao); { - val path = if3(abs_path_p(target), + val path = if3(!pure_rel_path_p(target), target, cat_str(nappend2(sub_list(split_str(parent, lit("/")), zero, negone), diff --git a/txr.1 b/txr.1 index df77876f..b36c12ac 100644 --- a/txr.1 +++ b/txr.1 @@ -7638,13 +7638,15 @@ If the .code *load-path* has a current value which is not .code nil -and the path is relative, then the path is interpreted relative +and the path is pure relative according to the +.code pure-rel-path-p +function, then the path is interpreted relative to the directory portion of the path which is stored in .codn *load-path* . If .code *load-path* -is nil, or the load path is absolute, then it the path is +is nil, or the load path is not pure relative, then it the path is taken as-is. If the file named by the path cannot be opened, then the @@ -44966,7 +44968,9 @@ argument is a string. If .meta target -specifies a relative pathname, then a special behavior applies. +specifies a pure relative pathname, as defined by the +.code pure-rel-path-p +function, then a special behavior applies. If an existing load operation is in progress, then the special variable .code *load-path* has a binding. In this case, @@ -44977,7 +44981,7 @@ If .code *load-path* has the value .codn nil , -then a relative +then a pure relative .meta target pathname is used as-is, and thus resolved relative to the current working directory. -- cgit v1.2.3