我试图用红色语言获得不同的路径。如果我cd到/myfolder
并运行以下命令:
/myfolder$ /path/to/red.exe /path/to/myscript.red
如何从脚本代码中获取这3条路径?
我试过了:
system/options/path ; Gives path/to/myscript
system/script/path ; Gives none
call/output "pwd" outstr ; Gives path/to/myscript
what-dir ; Gives path/to/myscript
我只能得到一条路。如何获取red.exe的路径和当前工作目录的路径(红色语言 - 而不是Rebol)?
注意:这与我在What-dir reporting own directory as current directory in Rebol
上的Rebol问题有关答案 0 :(得分:0)
在Rebol(2& 3)中,您可以通过以下方式获得这三条路径:
system/options/boot ;; /path/to/red.exe
system/options/path ;; /myfolder
system/script/path ;; /path/to/myscript.red
目前只有红色的system/options/boot
符合Rebol在这里的作用。
答案 1 :(得分:0)
从GUI控制台:
boot string! {C:\ProgramData\Red\gui-console-2017-11-30-4300.exe}
home none! none
path file! %/C/ProgramData/Red/
script none! none
cache file! %/C/ProgramData/Red/
来自cli:
boot string! "C:\ProgramData\Red\console-2017-11-30-4430.
home none! none
path file! %/C/Users/Old%20Man/desktop/
script none! none
cache file! %/C/ProgramData/Red/
使用GUI控制台:
system/options/boot ; Red binary
system/options/path ; current dir
system/options/cache ; Red default dir "home"
system / options / boot是string!
,因此您必须将其转换为:
to-red-file system/options/boot