Skip to content

Commit

Permalink
FIX: modify cd to accept cd /
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Jul 7, 2020
1 parent dc57918 commit ed20ac3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/mezz/mezz-shell.reb
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ mkdir: :make-dir

cd: func [
"Change directory (shell shortcut function)."
'path [file! word! path! unset! string!] "Accepts %file, :variables and just words (as dirs)"
'path "Accepts %file, :variables and just words (as dirs)"
/local val
][
switch type?/word :path [
;unset! [print what-dir] ;-- looks like now need to print it as what-dir is now as a result
file! [change-dir get :path]
string! [change-dir to-rebol-file path]
change-dir to-rebol-file switch/default type?/word :path [
unset! [return what-dir]
file! [get :path]
string! [path]
word! path! [
change-dir either all [
not error? set/any 'val try [get :path]
not function? :val
val
][ val ][ to-file path ]
form either all [
not error? try [set/any 'val get/any path]
not any-function? :val
probe val
][ val ][ path ]
]
]
][ form path ]
what-dir
]

Expand Down
13 changes: 13 additions & 0 deletions src/tests/units/file-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,21 @@ Rebol [
Needs: [%../quick-test-module.r3]
]

secure [%/ allow]

~~~start-file~~~ "FILE tests"

===start-group=== "cd"
--test-- "cd / cd ~"
dir: what-dir
--assert all [
not error? try [cd /]
not error? try [cd ~]
]
change-dir dir
===end-group===


===start-group=== "to-local-file"

--test-- "issue-2351"
Expand Down

0 comments on commit ed20ac3

Please sign in to comment.