I'm having serious trouble using VfsUtil.findFileByUrl().
The situation is as follows:
I have a VirtualFile instance. The URL for that file (obtained by VirtualFile.getUrl()
is written into my plugin configuration. When this URL is read back again, I try to get
an instance to a VirtualFile by calling VfsUtil.findFileByUrl(). But that always fails
and returns null. The URL looks correctly and the denoted file exists.
Now the interesting part: When using
it works. So, what's the difference?
The only difference I noticed is, that the URL returned by VirtualFile.getUrl() looks like this:
Whereas the URL from File.toURL() looks like this
It looks like the additional / confuses IDEA somehow. Since I don't think this is a bug
in IDEA (I guess a lot internal stuff depends on that) I think I've missed something in the
OpenAPI for dealing with URLs, VirtualFiles, etc.
Can someone point me into the right direction please?