Arc Forumnew | comments | leaders | submitlogin
3 points by jsgrahamus 1001 days ago | link | parent

  Sorry it took so long.

  Running on Windows 10 Home, and Racket v8.0[cs (Downloaded 1 day ago)]:
  arc> (outfile "~/test.txt")
  expand-user-path: bad username in path
    path: ~/test.txt
    system error: unsupported; rkt_err=1
    context...:
     body of "D:\Steve - D\Documents - D\git\anarki\ac.rkt"
     D:\Steve - D\Documents - D\git\anarki\ac.rkt:1014:14: outfile
     D:\Steve - D\Documents - D\git\anarki\ac.rkt:1459:4

  arc> (outfile "~\test.txt")
  expand-user-path: bad username in path
    path: ~       est.txt
    system error: unsupported; rkt_err=1
    context...:
     body of "D:\Steve - D\Documents - D\git\anarki\ac.rkt"
     D:\Steve - D\Documents - D\git\anarki\ac.rkt:1014:14: outfile
     D:\Steve - D\Documents - D\git\anarki\ac.rkt:1459:4

  arc> (outfile "~\\test.txt")
  expand-user-path: bad username in path
    path: ~\test.txt
    system error: unsupported; rkt_err=1
    context...:
     body of "D:\Steve - D\Documents - D\git\anarki\ac.rkt"
     D:\Steve - D\Documents - D\git\anarki\ac.rkt:1014:14: outfile
     D:\Steve - D\Documents - D\git\anarki\ac.rkt:1459:4

  arc>


3 points by rocketnia 999 days ago | link

If I understand right, I think those are supposed to be errors still. The documentation for `expand-user-path` says "In addition, on Unix and Mac OS, a leading ~ is treated as user’s home directory and expanded[...]" but it doesn't say there's any corresponding behavior on Windows.

-----

3 points by zck 999 days ago | link

Ah, interesting. That's a good point that it's Unix/MacOS-specific. My hope was that it should make Arc interpret paths the same way the default shell on the system does. On Linux, ~/ is the home directory of the current user, so it makes sense that Anarki would work that way on Linux. But Windows doesn't work that way, so it makes sense Anarki wouldn't either.

I don't know of any similar path tricks on Windows, But, if this change hasn't broken anything on Windows, I would be satisfied with that. Can you verify it still works to open an existing file? Are there any other special ways to refer to files or directories on Windows?

-----

2 points by rocketnia 993 days ago | link

"On Linux, ~/ is the home directory of the current user, so it makes sense that Anarki would work that way on Linux. But Windows doesn't work that way, so it makes sense Anarki wouldn't either."

Yeah, I don't know much about what a Windows user would expect ~ to do. I would say `expand-user-path` leaving ~ alone on Windows is probably as good a behavior as any. It coincides with Command Prompt, where ~ just refers to a file or folder named "~". In PowerShell, ~ seems to be expanded to C:\Users\[username]\ somehow, so there's potentially an alternative design there.

---

"I don't know of any similar path tricks on Windows, But, if this change hasn't broken anything on Windows, I would be satisfied with that. Can you verify it still works to open an existing file?"

On Windows 10 64-bit with Racket 8.1, I've at least run the tests.arc unit tests, the unit-test.arc/tests.arc unit tests, and build-web-help.arc, and they seem to work.

---

"Are there any other special ways to refer to files or directories on Windows?"

Racket deals with a lot more Windows path features than I've ever learned about or encountered, and there's some gritty documentation of that here: https://docs.racket-lang.org/reference/windowspaths.html

I hardly know where to begin learning about and testing those features, and the documentation makes it look like Racket has explored hat rabbit hole pretty thoroughly already, so I'm inclined to suggest we just piggyback on Racket's work here.

-----