Windows: theia.Uri and paths

Hi all,

I’m writing a backend plugin (for theia electron application) interacting with local Windows host machine.

Plugin application code handles URI by using theia.Uri class.
These theia.Uri instances are consumed by fs and path node libraries in order to read, write, create and delete files and folders.

Running the plugin on the macOs platform, no problem. All files and folders are managed correctly.
Running on Windows , I got errors. Many errors.

Follow code should be able reproduce the issue:
\ rootFoldUri is a theia.Uri instance got from theia.window.showOpenDialog
let parentFoldUri: theia.Uri = theia.Uri.parse(path.join(rootFoldUri.fsPath, “exampleParentFold”));
let childFoldUri: theia.Uri = theia.Uri.parse(path.join(parentFoldUri.fsPath, “exampleChildFold”))
fs.mkdirSync(parentFoldUri.fsPath); \ OK
fs.mkdirSync(childFoldUri.fsPath); \ KO! "unknown error mkdir "

In addition trying to update workspaces with parentFoldUri (that above works fine), I get same error obtained for childFoldUri case.
Code which updates workspaces folders:

Are you already aware about this kind of issue?

Thanks in advance

[original thread by davide-sergi]

Can you try with FileUri.fsPath instead?


Ok, It exactly fits this issue. Thank you very much @kittaakos !

Being out of plugin API perimeter, is there a standard way to import it in the plugin code?