diff --git a/collects/compiler/commands/exe.rkt b/collects/compiler/commands/exe.rkt index 117e44429b..2bd1ec1473 100644 --- a/collects/compiler/commands/exe.rkt +++ b/collects/compiler/commands/exe.rkt @@ -14,7 +14,7 @@ (define exe-embedded-flags (make-parameter '("-U" "--"))) (define exe-embedded-libraries (make-parameter null)) (define exe-aux (make-parameter null)) -(define exe-embedded-collects-path (make-parameter #f)) +(define exe-embedded-collects-path (make-parameter null)) (define exe-embedded-collects-dest (make-parameter #f)) (define source-file diff --git a/collects/compiler/private/collects-path.rkt b/collects/compiler/private/collects-path.rkt index 3b2cd70f3a..a31172bcd8 100644 --- a/collects/compiler/private/collects-path.rkt +++ b/collects/compiler/private/collects-path.rkt @@ -28,9 +28,8 @@ (when collects-path (unless (or (path-string? collects-path) (and (list? collects-path) - (pair? collects-path) (andmap path-string? collects-path))) - (raise-type-error who "path, string, non-empty list of paths and strings, or #f" + (raise-type-error who "path, string, list of paths and strings, or #f" collects-path)) (unless ((bytes-length collects-path-bytes) . <= . 1024) (error who "collects path list is too long")))) diff --git a/collects/scribblings/raco/exe-api.scrbl b/collects/scribblings/raco/exe-api.scrbl index 682c358040..eab06fe350 100644 --- a/collects/scribblings/raco/exe-api.scrbl +++ b/collects/scribblings/raco/exe-api.scrbl @@ -2,6 +2,7 @@ @(require scribble/manual scribble/bnf + "common.rkt" (for-label racket/gui compiler/compiler compiler/sig @@ -271,12 +272,17 @@ collections---which are used to initialize the @racket[current-library-collection-paths] list in combination with @envvar{PLTCOLLECTS} environment variable. Otherwise, the argument specifies a replacement; it must be either a path, string, or -non-empty list of paths and strings. In the last case, the first path +list of paths and strings. In the last case, the first path or string specifies the main collection directory, and the rest are additional directories for the collection search path (placed, in order, after the user-specific @filepath{collects} directory, but before the main @filepath{collects} directory; then the search list is -combined with @envvar{PLTCOLLECTS}, if it is defined). +combined with @envvar{PLTCOLLECTS}, if it is defined). If the list +is empty, then @racket[(find-system-path 'collects-dir)] will return +the directory of the executable, but @racket[current-library-collection-paths] +is initialized to an empty list and +@racket[use-collection-link-paths] is set to false to disable the +use of @tech[#:doc reference-doc]{collection links files}. If the @racket[#:launcher?] argument is @racket[#t], then no @racket[module]s should be null, @racket[literal-files] should be diff --git a/src/racket/cmdline.inc b/src/racket/cmdline.inc index b30c845df0..8fd36f5f7a 100644 --- a/src/racket/cmdline.inc +++ b/src/racket/cmdline.inc @@ -122,6 +122,16 @@ static char *make_embedded_load(const char *start, const char *end) return s; } + +static Scheme_Object *check_make_path(const char *prog, const char *real_switch, char *arg) +{ + if (!*arg) { + PRINTF("%s: empty path after %s switch\n", + prog, real_switch); + exit(1); + } + return scheme_make_path(arg); +} #endif enum { @@ -555,6 +565,7 @@ static int run_from_cmd_line(int argc, char *_argv[], Scheme_Env *global_env; char *prog, *sprog = NULL; Scheme_Object *sch_argv; + int skip_coll_dirs = 0; Scheme_Object *collects_path = NULL, *collects_extra = NULL, *addon_dir = NULL; Scheme_Object *links_file = NULL; #ifndef NO_FILE_SYSTEM_UTILS @@ -849,7 +860,7 @@ static int run_from_cmd_line(int argc, char *_argv[], } argv++; --argc; - collects_path = scheme_make_path(argv[0]); + collects_path = check_make_path(prog, real_switch, argv[0]); was_config_flag = 1; break; case 'A': @@ -860,7 +871,7 @@ static int run_from_cmd_line(int argc, char *_argv[], } argv++; --argc; - addon_dir = scheme_make_path(argv[0]); + addon_dir = check_make_path(prog, real_switch, argv[0]); was_config_flag = 1; break; case 'C': @@ -871,7 +882,7 @@ static int run_from_cmd_line(int argc, char *_argv[], } argv++; --argc; - links_file = scheme_make_path(argv[0]); + links_file = check_make_path(prog, real_switch, argv[0]); was_config_flag = 1; break; case 'U': @@ -899,7 +910,7 @@ static int run_from_cmd_line(int argc, char *_argv[], --argc; if (!collects_extra) collects_extra = scheme_make_null(); - collects_extra = scheme_make_pair(scheme_make_path(argv[0]), collects_extra); + collects_extra = scheme_make_pair(check_make_path(prog, real_switch, argv[0]), collects_extra); was_config_flag = 1; break; case 'c': @@ -1163,9 +1174,16 @@ static int run_from_cmd_line(int argc, char *_argv[], #ifndef NO_FILE_SYSTEM_UTILS /* Setup path for "collects" collection directory: */ - if (!collects_path) - collects_path = scheme_make_path(_coldir XFORM_OK_PLUS _coldir_offset); - else + if (!collects_path) { + if (!_coldir[_coldir_offset]) { + /* empty list of directories => don't set collection dirs + and don't use collection links files */ + skip_coll_dirs = 1; + scheme_set_ignore_link_paths(1); + collects_path = scheme_make_path("."); + } else + collects_path = scheme_make_path(_coldir XFORM_OK_PLUS _coldir_offset); + } else collects_path = scheme_path_to_complete_path(collects_path, NULL); scheme_set_collects_path(collects_path); @@ -1246,7 +1264,8 @@ static int run_from_cmd_line(int argc, char *_argv[], global_env = mk_basic_env(); #ifndef NO_FILE_SYSTEM_UTILS - scheme_init_collection_paths_post(global_env, collects_paths_l, collects_paths_r); + if (!skip_coll_dirs) + scheme_init_collection_paths_post(global_env, collects_paths_l, collects_paths_r); #endif scheme_seal_parameters();