Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 12769

Summary: CoreFileSystemLibrary.isReadOnly(String) doesn't work for new files if no natives
Product: [Eclipse Project] Platform Reporter: Jerome Lanneluc <jerome_lanneluc>
Component: ResourcesAssignee: DJ Houghton <dj.houghton>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: hroark, rodrigo
Version: 2.0   
Target Milestone: 2.0 M5   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Jerome Lanneluc CLA 2002-04-04 06:04:11 EST
Build 20020402

If the natives have not been loaded, CoreFileSystemLibrary.isReadOnly(String) 
returns false for a file that does not exist yet. It returns true if the 
natives have been loaded. This is on Win2k.
Comment 1 DJ Houghton CLA 2002-04-04 09:22:47 EST
The implementation defaults to java.io.File behaviour; essentially:
  return !new java.io.File(filename).canWrite();
java.io.File.canWrite() is spec'd to return false if the file doesn't exist.

I have tried this in a scrapbook and it works ok. (Win98)
Will try in Win2K to see what we get.
Comment 2 Jerome Lanneluc CLA 2002-04-04 09:52:43 EST
I agree that java.io.File.canWrite() is working as expected. I just think that 
its usage is wrong (in the case of a non-existing file) if we want to have the 
same behavior as:
  isSet(getStat(fileName), STAT_READ_ONLY);
Comment 3 DJ Houghton CLA 2002-04-04 09:59:19 EST
Oops...now I see what you mean. Sorry.

isReadOnly() should return false for a non-existing file but using canWrite() 
returns true.
Comment 4 DJ Houghton CLA 2002-04-10 13:28:05 EDT
Fixed and released. 
Available in builds > 2002-04-09.
Comment 5 DJ Houghton CLA 2002-04-10 20:50:22 EDT
*** Bug 12979 has been marked as a duplicate of this bug. ***
Comment 6 Alvin Thompson CLA 2002-04-10 20:57:55 EDT
bug 12979 was marked as a dup, but the problem still exists in 4/10 build...
Comment 7 DJ Houghton CLA 2002-04-10 21:16:24 EDT
Try an integration build after 2002-04-09.
Comment 8 DJ Houghton CLA 2002-12-03 18:03:44 EST
*** Bug 3100 has been marked as a duplicate of this bug. ***