在sml中使用操作(smlnj windows当前目录在哪里)
我从未在 Windows 机器上使用过 SML(之前在带有 emacs 的 unix 机器上使用过)。
在我的一生中,我在 sml 环境中找不到当前目录。如果我尝试:使用“filename.sml”,它会引发异常。我无法找到放置文件的位置。btw
文件是用 notepad++ 编写的,并且仅以 .sml 扩展名命名。
I have never used SML on a Windows machine (have before on a unix machine w/ emacs).
for the life of me I cannot find the current directory when in the sml environment. If I attempt to: use "filename.sml" it raising an exception.. I cannot find out where to place my file..
btw file is written in notepad++ and merely named w/ a .sml extension.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当前工作目录将是您启动 SML 解释器的位置。如果你的桌面上有一个快捷方式,那么我猜你可以在快捷方式的属性中设置CWD(我不是Windows用户),我猜它默认是你有SML的目录/NJ 安装。
如果您从命令行启动 sml 解释器,那么 CWD 就是您启动解释器时所在的目录。
您可以使用以下命令
您还可以使用 OS.FileSys 将 CWD 更改为另一个工作目录.chDir。
然而,当尝试使用
use
Update“加载”sml 文件时,使用绝对路径会更容易。
很简单:您可以执行以下操作
在 Windows 文件系统上,您显然必须转义退格键。下面的代码应该可以工作,但我无法测试它,因为我没有 Windows。
在您写的评论中,您忘记了转义最后两个退格键。
The current working directory would be from where you start your SML interpreter. If you have a shortcut on your desktop, then I would gues you can set the CWD in the properties of the shortcut (I'm not a windows user), I would gues that it, by default, is the directory where you have SML/NJ installed.
If you start the sml interpreter from the commandline, then the CWD is the directory you were in, when you started the interpreter.
You can get the interpreter to output its CWD with the following command
And you can also change the CWD to another working directory with OS.FileSys.chDir.
It is however easyer to just use absolute paths when trying to "load" sml files with
use
Update.
Quite easy: You can do the following
On a windows file system you obviously have to escape the backspaces. The below code ought to work, but I can't test it as I don't have windows.
In the comment you wrote, you had forgot to escape the two last backspaces.