- /* Turn PATH_EXEC into a path. `==' is just a string which we know
- will not be the name of an environment variable. */
- Vexec_path = decode_env_path ("==", PATH_EXEC);
- Vexec_directory = Ffile_name_as_directory (Fcar (Vexec_path));
- Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path);
+ if (initialized && !NILP (Vinvocation_directory))
+ {
+ /* Add to the path the ../lib-src dir of the Emacs executable,
+ if that dir exists. */
+ Lisp_Object tem, tem1;
+ tem = Fexpand_file_name (build_string ("../lib-src"),
+ Vinvocation_directory);
+ tem1 = Ffile_exists_p (tem);
+ if (!NILP (tem1) && NILP (Fmember (tem, Vexec_path)))
+ {
+ Vexec_path = nconc2 (Vexec_path, Fcons (tem, Qnil));
+ Vexec_directory = Ffile_name_as_directory (tem);
+
+ /* If we use ../lib-src, maybe use ../etc as well.
+ Do so if ../etc exists and has our DOC-... file in it. */
+ if (data_dir == 0)
+ {
+ Lisp_Object tem, tem2, tem3;
+ tem = Fexpand_file_name (build_string ("../etc"),
+ Vinvocation_directory);
+ tem2 = Fexpand_file_name (Vdoc_file_name, tem);
+ tem3 = Ffile_exists_p (tem2);
+ if (!NILP (tem3))
+ Vdata_directory = Ffile_name_as_directory (tem);
+ }
+ }
+ }