Changing ReadOnly Property of File/Directory

How can I change the readonly property of a file opened up by intellij via openapi? I can't seem to find this call in VirtualFile.

Also, why does IntelliJ complain when I try to move a directory with a readonly file. It says that it cannot delete the file.

Thank you.

4 comments
Comment actions Permalink

JDK java.io.File class have disabled setting file attributes. It depend on host platform and diferent from OS to OS.

It not possible now, and i think it will be not possible in future...

Thanks!

0
Comment actions Permalink

But I can change this property when I am inside the IDE by double clicking on the padlock on the status bar. There has to be a way I can get to this.

Thanks.

0
Comment actions Permalink

I attached an util class to do that. Hope this help

Jacques



Attachment(s):
FileUtil.java
0
Comment actions Permalink

Well, since that functionaloty is OS dependent, it may never be opened.
I think they just do it on Windows by spawning a command "cmd.exe /c attrib -r ..."
Why it is not part of the Java File class I cannot fathom. Probably an old
request in Bug Parade somewhere...

no_mail@jetbrains.com wrote:

But I can change this property when I am inside the IDE by double clicking on the padlock on the status bar. There has to be a way I can get to this.

Thanks.


--

Erb

==============================================================
"Most of you are familiar with the virtues of a programmer.
There are three, of course: laziness, impatience, and hubris."
- Larry Wall
==============================================================

0

Please sign in to leave a comment.