From ad18857c6ec81dd3b2d25ea66f86938243dcc96f Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 24 Apr 2006 19:20:44 +0000 Subject: [PATCH] add 'orig-dir system path svn: r2767 --- src/mzscheme/include/scheme.h | 1 + src/mzscheme/src/file.c | 16 ++++++++++++++-- src/mzscheme/src/thread.c | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/mzscheme/include/scheme.h b/src/mzscheme/include/scheme.h index 4137618d15..cad3b4bde5 100644 --- a/src/mzscheme/include/scheme.h +++ b/src/mzscheme/include/scheme.h @@ -1565,6 +1565,7 @@ MZ_EXTERN void scheme_set_banner(char *s); MZ_EXTERN Scheme_Object *scheme_set_exec_cmd(char *s); MZ_EXTERN Scheme_Object *scheme_set_run_cmd(char *s); MZ_EXTERN void scheme_set_collects_path(Scheme_Object *p); +MZ_EXTERN void scheme_set_original_dir(Scheme_Object *d); /* Initialization */ MZ_EXTERN Scheme_Env *scheme_basic_env(void); diff --git a/src/mzscheme/src/file.c b/src/mzscheme/src/file.c index 4deb71c4cf..675a435665 100644 --- a/src/mzscheme/src/file.c +++ b/src/mzscheme/src/file.c @@ -185,9 +185,9 @@ static Scheme_Object *temp_dir_symbol, *home_dir_symbol, *pref_dir_symbol; static Scheme_Object *doc_dir_symbol, *desk_dir_symbol; static Scheme_Object *init_dir_symbol, *init_file_symbol, *sys_dir_symbol; static Scheme_Object *exec_file_symbol, *run_file_symbol, *collects_dir_symbol; -static Scheme_Object *pref_file_symbol, *addon_dir_symbol; +static Scheme_Object *pref_file_symbol, *orig_dir_symbol, *addon_dir_symbol; -static Scheme_Object *exec_cmd, *run_cmd, *collects_path; +static Scheme_Object *exec_cmd, *run_cmd, *collects_path, *original_pwd; #endif void scheme_init_file(Scheme_Env *env) @@ -212,6 +212,7 @@ void scheme_init_file(Scheme_Env *env) REGISTER_SO(exec_file_symbol); REGISTER_SO(run_file_symbol); REGISTER_SO(collects_dir_symbol); + REGISTER_SO(orig_dir_symbol); REGISTER_SO(addon_dir_symbol); #endif @@ -236,6 +237,7 @@ void scheme_init_file(Scheme_Env *env) exec_file_symbol = scheme_intern_symbol("exec-file"); run_file_symbol = scheme_intern_symbol("run-file"); collects_dir_symbol = scheme_intern_symbol("collects-dir"); + orig_dir_symbol = scheme_intern_symbol("orig-dir"); addon_dir_symbol = scheme_intern_symbol("addon-dir"); #endif @@ -4489,6 +4491,8 @@ find_system_path(int argc, Scheme_Object **argv) collects_path = scheme_make_path("collects"); } return collects_path; + } else if (argv[0] == orig_dir_symbol) { + return original_pwd; } else if (argv[0] == addon_dir_symbol) { which = id_addon_dir; } else { @@ -4752,6 +4756,14 @@ void scheme_set_collects_path(Scheme_Object *p) collects_path = p; } +void scheme_set_original_dir(Scheme_Object *d) +{ + if (!original_pwd) { + REGISTER_SO(original_pwd); + } + original_pwd = d; +} + /********************************************************************************/ #ifdef DOS_FILE_SYSTEM diff --git a/src/mzscheme/src/thread.c b/src/mzscheme/src/thread.c index fc97048488..b8fd2f776e 100644 --- a/src/mzscheme/src/thread.c +++ b/src/mzscheme/src/thread.c @@ -5922,6 +5922,7 @@ static void make_initial_config(Scheme_Thread *p) Scheme_Object *s; s = scheme_make_path(scheme_os_getcwd(NULL, 0, NULL, 1)); init_param(cells, paramz, MZCONFIG_CURRENT_DIRECTORY, s); + scheme_set_original_dir(s); } {