Automatically generated folders do not appear

Put your problem here if it does not fit any of the other categories.

Automatically generated folders do not appear

Postby Niksac » Mon Feb 28, 2011 1:44 am

Hi

I use a Java File Objects mkdirs method to create a folder structure on the SD Card

my code:
Code: Select all
File sdcard = Environment.getExternalStorageDirectory();
File dir = new File (sdcard.getAbsolutePath() + "/dir/subdir");
dir.mkdirs();


When i run the application the folders are being created. Using a file manager program or the shell i can see them.
Connecting the phone to my pc with sd card access enabled on my phone the folders do not appear :(

If i create the structure on my pc it appears twice using file managers. Deleting the automatically generated folder leaving the one created by windows leads to java recreating the directories.

Any ideas on that?

Nik
Niksac
Junior Developer
Junior Developer
 
Posts: 10
Joined: Sun May 17, 2009 11:10 pm

Top

Re: Automatically generated folders do not appear

Postby strider2023 » Mon Feb 28, 2011 11:02 am

That pretty weird...trying passing the whole path as a string (just a thought)...

File dir = new File ("/sdcard/dir/subdir/");
strider2023
Senior Developer
Senior Developer
 
Posts: 126
Joined: Tue Mar 02, 2010 6:34 am
Location: Chennai, India

Re: Automatically generated folders do not appear

Postby Niksac » Mon Feb 28, 2011 12:00 pm

Setting the path manually really solved the problem.
Turns out sdcard.getAbsolutePath() returns "/mnt/sdcard" for me.
The sd card seems to be mounted to there as well.

BTW i am running a Cjanogen Gingerbread on my HTC Desire.

Any Ideas why /mnt/sdcard behaves this way ?
Niksac
Junior Developer
Junior Developer
 
Posts: 10
Joined: Sun May 17, 2009 11:10 pm

Re: Automatically generated folders do not appear

Postby strider2023 » Mon Feb 28, 2011 12:53 pm

Well even I ran into this problem once when I was making an email client (while uploading attachments). Well later i found out that they where just reference difference. There's no practical difference unless you are running adb shells. :?
strider2023
Senior Developer
Senior Developer
 
Posts: 126
Joined: Tue Mar 02, 2010 6:34 am
Location: Chennai, India

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: MSNbot Media and 14 guests