Quantcast
Channel: JetBrains Developer Community : Thread List - IntelliJ IDEA Users
Viewing all articles
Browse latest Browse all 5661

Renaming and moving a file from a plugin

$
0
0

Hi,

 

I'd like to rename and move a file inside a plugin I'm developing. I was thinking of using the methods available on the VirtualFile ap instead of refactoring. Renaming a file is pretty straight forward, but moving seems kind of complicated. I have a path and a file name, and the new path may not yet exist. Do I have to write code to check to see if all the intermediate directories exist before moving? I was thinking of using FilenameIndex.getFilesByName to test to see if a directory exists, if not move up until I get one that does and then create the missing intermediate directories, and then once I have the final directory I need to move to, use the move method on VirtualFile. Is that the way to do it? Would be nice if one could just give a full path to rename and it both moved the file and renamed it and created any missing intermediate directories. I don't think that exists though.


Viewing all articles
Browse latest Browse all 5661

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>