Files can't be created in "My Documents" folder
Hi,
I am facing a funny problem and have to resolve a critical bug related to this. I am not been able to create files in 揗y Documents? 揗y Videos?or 揗y Music?folders as canWrite() method is returning false. Whereas if I create a folder in any of the above folder say 搮\\MyDocuments\\My eBooks?then canWrite() method returns true and allows me to write file. I have checked the file Permission on above folders and it is writable. My OS is Windows XP. Can anyone help me on this? Thanks in advance.
You can refer to the following code:
--
import java.io.*;
class ReadWriteCheck
{
public static void main(String[] args)
{
File file1 = new File("C:\\Documents and Settings\\udayan_khattry\\My Documents"); // System folder
File file2 = new File("C:\\Documents and Settings\\udayan_khattry\\My Documents\\My Music"); // System folder
File file3 = new File("C:\\Documents and Settings\\udayan_khattry\\My Documents\\My Videos"); // System folder
File file4 = new File("C:\\Documents and Settings\\udayan_khattry\\My Documents\\My eBooks"); // User folder
System.out.println(file1.canWrite()); //false
System.out.println(file2.canWrite()); //false
System.out.println(file3.canWrite()); //false
System.out.println(file4.canWrite()); // ture
}
}
-

