I am working on plugin in on IntelliJ.
Now I have a VirtualFile file
, I am trying to write file.getUrl()
to local file system so that I can get file
back when I restart my plugin. But It seems I can not get the VirtualFile
from a url
?
答案 0 :(得分:0)
要按网址查找文件,请使用VirtualFileManager.findFileByUrl()
(source)。或者保持简单,存储路径并按照@vikingsteve的建议使用LocalFileSystem.findFileByPath()
。
答案 1 :(得分:0)
VirtualFile[] vFiles = ProjectRootManager.getInstance(this.project).getContentRoots();
VirtualFile stateMachineConfig = vFiles[0].findChild("stateConfig.json");