- Vload_path = decode_env_path (0, normal);
- dump_path = Vload_path;
- /* No point calling load_path_check; load-path only contains essential
- elements from the source directory at this point. They cannot
- be missing unless something went extremely (and improbably)
- wrong, in which case the build will fail in obvious ways. */
+ lpath = decode_env_path (0, normal, 0);
+ dump_path = lpath;
+ }
+#endif /* !CANNOT_DUMP */
+
+ return lpath;
+}
+
+void
+init_lread (void)
+{
+ /* First, set Vload_path. */
+
+ /* NB: Do not change Vload_path before calling load_path_default,
+ since it may check it against dump_path.
+ (This behavior could be changed.) */
+
+ /* We explicitly ignore EMACSLOADPATH when dumping. */
+ if (NILP (Vpurify_flag) && egetenv ("EMACSLOADPATH"))
+ {
+ Lisp_Object elpath = decode_env_path ("EMACSLOADPATH", 0, 1);
+
+ /* Check (non-nil) user-supplied elements. */
+ load_path_check (elpath);
+
+ /* If no nils in the environment variable, use as-is.
+ Otherwise, replace any nils with the default. */
+ if (NILP (Fmemq (Qnil, elpath)))
+ {
+ Vload_path = elpath;
+ }
+ else
+ {
+ Lisp_Object elem, default_lpath = load_path_default (0);
+
+ /* Check defaults, before adding site-lisp. */
+ load_path_check (default_lpath);
+
+ /* Add the site-lisp directories to the front of the default. */
+ if (!no_site_lisp)
+ {
+ Lisp_Object sitelisp;
+ sitelisp = decode_env_path (0, PATH_SITELOADSEARCH, 0);
+ if (! NILP (sitelisp))
+ default_lpath = nconc2 (sitelisp, default_lpath);
+ }
+
+ Vload_path = Qnil;
+
+ /* Replace nils from EMACSLOADPATH by default. */
+ while (CONSP (elpath))
+ {
+ Lisp_Object arg[2];
+ elem = XCAR (elpath);
+ elpath = XCDR (elpath);
+ arg[0] = Vload_path;
+ arg[1] = NILP (elem) ? default_lpath : Fcons (elem, Qnil);
+ Vload_path = Fappend (2, arg);
+ }
+ } /* Fmemq (Qnil, Vload_path) */