What-dir reporting own directory as current directory in Rebol

我的未来我决定 提交于 2019-12-11 05:25:48

问题


I am running Rebol on Debian Stable Linux and I have put rebol executable in /usr/local/bin. Then I have created following script file and also kept it in /usr/local/bin:

#! /usr/local/bin/rebol

REBOL []

print what-dir
quit

However, when I run this script from any directory, it only reports "/usr/local/bin/" and not current working directory. I want to get current working directory to perform operations from code.

Following code, using Linux shell command pwd (print working directory) also reports the same:

print call "pwd"

How can this problem be solved?


回答1:


You can find your own directory where you are in system/options/path and if you want it to be your current working directory and what-dir to report your own directory as current directory, you have to add this line

system/script/path: system/options/path

or

change-dir system/options/path

before calling what-dir.

Even call "pwd" uses and shows now your own as current directory under Linux




回答2:


I agree, this behaviour is quite unintuitive.

I came across the same situation a while ago, and I kept on making the same mistake over and over... I eventually placed that change-dir system/options/path in a more general routines script, which is loaded from my ~/.rebol/view/user.r.

Mind you though, one could also put that statement within the user.r.



来源:https://stackoverflow.com/questions/46461448/what-dir-reporting-own-directory-as-current-directory-in-rebol

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!