Reputation: 897
I'm developing an application where I implement the GUI in QtQuick and the logic in OCaml, using lablqt. In QtQuick I use a FileDialog to select a file. I need to use the path that the FileDialog
returns in my OCaml program but I get an error every time I do this.
The path returned by FileDialog is file:///home/thomas/Desktop/Sudoku/example.txt
This is the correct path, but when I try to acces this file in OCaml I get the following error:
Fatal error: exception Sys_error("file:///home/thomas/Desktop/Sudoku/example.txt: No such file or directory")
How can I convert this path gotten from the FileDialog
to a path I can use in OCaml?
Upvotes: 1
Views: 494
Reputation: 35260
You need to remove the protocol part from the returned url, i.e., this file://
. You can do this either manually, or use uri
library, that will handle it for you.
Upvotes: 1