Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Writing to a file with the hidden attribute (Windows)
Writing to a file with the hidden attribute (Windows) [message #314775] Mon, 23 April 2007 16:21 Go to next message
Eclipse UserFriend
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 21:12 Go to previous message
Richard Gobeli is currently offline Richard GobeliFriend
Messages: 18
Registered: July 2009
Junior Member
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.

Previous Topic:[Solved] Help for customizing an eclipse context menu
Next Topic:Is internal use of IProgressMonitor in an Eclipse plugin bad practice?
Goto Forum:
  


Current Time: Thu Apr 25 14:13:24 GMT 2024

Powered by FUDForum. Page generated in 0.06024 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top