Writing to a file with the hidden attribute (Windows) [message #314775] |
Mon, 23 April 2007 12:21  |
Eclipse User |
|
|
|
Originally posted by: dmsubs.NOSPAM.consertum.com
Hi,
I am running Eclipse 3.2.2 under Windows.
I have written a plugin that is using IFile#setContents() to write to a file in
a project. One of my users is getting a CoreException "Could not write file".
It turns out that the file has the 'hidden' attribute set, although it is writable.
Q1. How can I detect if this attribute is set, and thus prevent the error
Q2. Why does this error occur anyway? The file is writable, it is just hidden.
Thanks,
--
Derek
|
|
|
Re: Writing to a file with the hidden attribute (Windows) [message #1691819 is a reply to message #314775] |
Thu, 09 April 2015 17:12  |
Eclipse User |
|
|
|
you need to do something like this to reset the attribute:
+ ResourceAttributes descriptionFileAttributes = descriptionFile.getResourceAttributes();
+ descriptionFileAttributes.setHidden(false);
+ descriptionFile.setResourceAttributes(descriptionFileAttributes);
Sun thought if the file is hidden it is effectively write protected, because a user would not be able to see the file from a list. The problem is this only was the intent of windows for it own internal files and not for the user.
Sun had a bug report to get this fixed after version 1.5 of Java. Java is now 1.8. Now, that Oracle has take over, I don't think this will ever be changed.
|
|
|
Powered by
FUDForum. Page generated in 0.57446 seconds