Module for deleted file?

Can anyone tell me how to get the module for a deleted file during its
commit? I'm accessing it's File object in a CommitHandler, and so have a
FilePath, but it appears that there is no VirtualFile for a deleted file
that I could pass to ModuleUtil.findModuleForFile().

Cheers,
N.

0
2 comments
Avatar
Permanently deleted user

Hello Nathan,

Can anyone tell me how to get the module for a deleted file during its
commit? I'm accessing it's File object in a CommitHandler, and so have
a FilePath, but it appears that there is no VirtualFile for a deleted
file that I could pass to ModuleUtil.findModuleForFile().


You can walk up the FilePath.getParentPath() chain until you find a FilePath
with a not-null VirtualFile, and then get the module for that file.

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Avatar
Permanently deleted user

Ah, of course! Thanks Dmitry!
N.

Dmitry Jemerov wrote:

Hello Nathan,

>> Can anyone tell me how to get the module for a deleted file during its
>> commit? I'm accessing it's File object in a CommitHandler, and so have
>> a FilePath, but it appears that there is no VirtualFile for a deleted
>> file that I could pass to ModuleUtil.findModuleForFile().


You can walk up the FilePath.getParentPath() chain until you find a
FilePath with a not-null VirtualFile, and then get the module for that
file.

0

Please sign in to leave a comment.