How to specify a full Windows path in Eio?

Hi all,

I am confused about the use of Eio.Path on Windows:

I am trying to handle a path, say, C:\path\file.txt. I initially tried to write it as Eio.Path.(fs / "C:\\path\\file.txt"), which did not work.

Then I noticed from Eio 1.1 documentation that “In Eio, the directory separator is always “/”, even on Windows.”, but I have tried the following options to put in Eio.Path.(fs / ...) to no success:

  • C:/path/file.txt
  • c:/path/file.txt
  • /C:/path/file.txt
  • /c:/path/file.txt
  • /C/path/file.txt
  • /c/path/file.txt
  • C/path/file.txt
  • c/path/file.txt

I’m lost on what I’m missing here.


Good question!

(fst fs, "C:/path/file.txt") should do, as a work-around.

I think we need a proper way to import native paths from the user.

/C:/path/file.txt makes sense to me as a generic form of an absolute Windows path, but I don’t think eio_windows accepts it currently. I’ve added a note at Windows support · Issue #125 · ocaml-multicore/eio · GitHub - more input from Windows users would be very helpful!

Thanks for the reply!

That doesn’t seem to work though, I still get a Unix.ENOENT error.

I must confess that introducing yet another notation for a Windows path doesn’t look at all sensible to me! /C:/path is simply invalid, and if that’s ever printed (error messages, exceptions, etc.) it kinda just looks like Eio doesn’t know what it’s doing.