Skip to content

Commit

Permalink
FIX: safely handle a case when path to the exe is not resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Jan 31, 2023
1 parent 0cdee8c commit ff5e131
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
5 changes: 4 additions & 1 deletion src/mezz/mezz-tail.reb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ func: funco [
codecs: :system/codecs
keys-of: :words-of ; as it sounds better when used with some objects

system/options/boot: clean-path system/options/boot
;; boot (path to the exe) may be none if not resolved!
if system/options/boot [
system/options/boot: clean-path system/options/boot
]

;protect system/standard
protect-system-object
19 changes: 11 additions & 8 deletions src/mezz/sys-start.reb
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,17 @@ start: func [

;-- Evaluate rebol.reb script:
;@@ https://github.com/Oldes/Rebol-issues/issues/706
tmp: first split-path boot
sys/log/info 'REBOL ["Checking for rebol.reb file in" tmp]

if all [
#"/" = first tmp ; only if we know absolute path
exists? tmp/rebol.reb
][
try/except [do tmp/rebol.reb][sys/log/error 'REBOL system/state/last-error]
;; boot (path to the exe) may be none if not resolved!
if boot [
tmp: first split-path boot
sys/log/info 'REBOL ["Checking for rebol.reb file in" tmp]

if all [
#"/" = first tmp ; only if we know absolute path
exists? tmp/rebol.reb
][
try/except [do tmp/rebol.reb][sys/log/error 'REBOL system/state/last-error]
]
]

;-- Make the user's global context:
Expand Down

0 comments on commit ff5e131

Please sign in to comment.