File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 36793679 \;
36803680 </scm-chunk>
36813681
3682+ <paragraph|path@from-env>
3683+
3684+ <\goldfish-chunk|goldfish/liii/path.scm|true|true>
3685+ (chained-define (@from-env name)
3686+
3687+ \ \ (path (getenv name)))
3688+
3689+ \;
3690+ </goldfish-chunk>
3691+
3692+ <\scm-chunk|tests/goldfish/liii/path-test.scm|true|true>
3693+ (when (os-linux?)
3694+
3695+ \ \ (check (path :from-env "HOME" :to-string) =\<gtr\> (path :home :to-string)))
3696+
3697+ \;
3698+
3699+ (when (os-windows?)
3700+
3701+ \ \ (check (path :from-env "USERPROFILE" :to-string) =\<gtr\> (path :home :to-string)))
3702+
3703+ \;
3704+ </scm-chunk>
3705+
36823706 \;
36833707
36843708 <subsection|谓词>
Original file line number Diff line number Diff line change 140140 (else
141141 (loop ($ iter :drop 1 :get))))))))
142142
143+ (chained-define (@from -env name)
144+ (path (getenv name)))
145+
143146(define (%file?)
144147 (path-file? (%to-string)))
145148
Original file line number Diff line number Diff line change 104104 (check (path " /tmp/" ) => (path :/ " tmp" ))
105105 (check (path " /tmp/tmp2" ) => (path :/ " tmp" :/ " tmp2" )))
106106
107+ (when (os-linux?)
108+ (check (path :from-env " HOME" :to-string) => (path :home :to-string)))
109+
110+ (when (os-windows?)
111+ (check (path :from-env " USERPROFILE" :to-string) => (path :home :to-string)))
112+
107113(when (or (os-linux?) (os-macos?))
108114 (check-false (path :/ " tmp" :file?))
109115 (chdir " /tmp" )
You can’t perform that action at this time.
0 commit comments