Closed rossknudsen closed 1 year ago
Some experimentation:
using System.IO;
Directory.GetCurrentDirectory(); // => "/"
Directory.Exists(Directory.GetCurrentDirectory()); // => true
Directory.GetFiles("/").Length; // => 0
string.Join(",", Directory.GetDirectories("/")); // => "/tmp,/home,/dev,/proc"
string.Join(",", Directory.GetDirectories("/home")); // => "/home/web_user"
Looks like the environment is sandboxed and you need to pass in a mapping for the WASM when initializing. I'd say you'd want to extend BootData
with an option to pass through the options, but I couldn't see where the changes would be made (somewhere in dotnet.js
I think).
Don't think nodejs's FS will work, even if you're not targeting web extensions because of the security restrictions. You'd have to use VS Code's abstraction layer APIs to access the files.
I'm working on a VS Code extension and writing the base implementation in .Net and calling from the extension in Typescript. I'm having trouble accessing local files from the .Net code using System.IO.* API. E.g. calling File.Exists() on a local Windows file path returns false for a valid path. I'm guessing that I don't have permission to access the file from the running process or the path needs to be modified. Any ideas?