X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fcommon-os.lisp;h=bf7174477bf001e90a7516348eaa720dad8a82d1;hb=52f174450abacd81963073b71af2ce7b62908178;hp=7de4d4632da54493a6f8b83b160dc15c59f047d7;hpb=b71853ba2228aae847de00da7fac9b9b89de8653;p=sbcl.git diff --git a/src/code/common-os.lisp b/src/code/common-os.lisp index 7de4d46..bf71744 100644 --- a/src/code/common-os.lisp +++ b/src/code/common-os.lisp @@ -13,12 +13,12 @@ (defvar *software-version* nil) -(defvar *core-pathname* nil - #!+sb-doc - "The absolute pathname of the running SBCL core.") - (sb!alien:define-alien-variable ("posix_argv" *native-posix-argv*) (* (* char))) (sb!alien:define-alien-variable ("core_string" *native-core-string*) (* char)) +(sb!alien:define-alien-routine + os-get-runtime-executable-path sb!alien:c-string (external-path boolean)) +(sb!alien:define-alien-variable + ("saved_runtime_path" *native-saved-runtime-path*) (* char)) ;;; if something ever needs to be done differently for one OS, then ;;; split out the different part into per-os functions. @@ -45,4 +45,9 @@ (/show0 "setting *CORE-PATHNAME*") (setf *core-pathname* (merge-pathnames (native-pathname *core-string*))) + (/show0 "setting *RUNTIME-PATHNAME*") + (let ((exe (os-get-runtime-executable-path t)) + (saved (sb!alien:cast *native-saved-runtime-path* sb!alien:c-string))) + (setf *runtime-pathname* + (when (or exe saved) (native-pathname (or exe saved))))) (/show0 "leaving OS-COLD-INIT-OR-REINIT"))