Skip to content

Commit ed20ac3

Browse files
committed
FIX: modify cd to accept cd /
1 parent dc57918 commit ed20ac3

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

src/mezz/mezz-shell.reb

+11-11
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ mkdir: :make-dir
1919

2020
cd: func [
2121
"Change directory (shell shortcut function)."
22-
'path [file! word! path! unset! string!] "Accepts %file, :variables and just words (as dirs)"
22+
'path "Accepts %file, :variables and just words (as dirs)"
2323
/local val
2424
][
25-
switch type?/word :path [
26-
;unset! [print what-dir] ;-- looks like now need to print it as what-dir is now as a result
27-
file! [change-dir get :path]
28-
string! [change-dir to-rebol-file path]
25+
change-dir to-rebol-file switch/default type?/word :path [
26+
unset! [return what-dir]
27+
file! [get :path]
28+
string! [path]
2929
word! path! [
30-
change-dir either all [
31-
not error? set/any 'val try [get :path]
32-
not function? :val
33-
val
34-
][ val ][ to-file path ]
30+
form either all [
31+
not error? try [set/any 'val get/any path]
32+
not any-function? :val
33+
probe val
34+
][ val ][ path ]
3535
]
36-
]
36+
][ form path ]
3737
what-dir
3838
]
3939

src/tests/units/file-test.r3

+13
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,21 @@ Rebol [
66
Needs: [%../quick-test-module.r3]
77
]
88

9+
secure [%/ allow]
10+
911
~~~start-file~~~ "FILE tests"
1012

13+
===start-group=== "cd"
14+
--test-- "cd / cd ~"
15+
dir: what-dir
16+
--assert all [
17+
not error? try [cd /]
18+
not error? try [cd ~]
19+
]
20+
change-dir dir
21+
===end-group===
22+
23+
1124
===start-group=== "to-local-file"
1225

1326
--test-- "issue-2351"

0 commit comments

Comments
 (0)