Create directory failed in file system

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

Create directory failed in file system

Postby cabernet1976 » Thu Jan 17, 2008 5:29 pm

Create directory successfully in SD card:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.            File sddir = new File("/sdcard/mydir1");
  2.  
  3.                 if (!sddir.mkdirs()) {
  4.  
  5.                         Log.e(TAG, "Create dir in sdcard failed");
  6.  
  7.                         return;
  8.  
  9.                 }
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


But create dir failed in file system:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                 try {
  2.  
  3.                         File dir = getFileStreamPath("mydir2");
  4.  
  5.                         if (!dir.mkdirs()) {
  6.  
  7.                                 Log.e(TAG, "Create dir in local failed"); //<--print this error
  8.  
  9.                                 return;
  10.  
  11.                         }
  12.  
  13.                 } catch (FileNotFoundException e1) {
  14.  
  15.                         Log.e(TAG, "error 1: "+e1.toString());
  16.  
  17.                 }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Could you tell me what I have missed? :roll:
Upload2Flickr's blog: http://upload2flickr.blogspot.com
cabernet1976
Senior Developer
Senior Developer
 
Posts: 154
Joined: Fri Nov 16, 2007 2:34 am
Location: China

Top

Postby plusminus » Mon Jan 21, 2008 9:00 am

Hello cabernet1976,

In the future SDKs there will be a new set of APIs explicitly for creating directories.
This is said to work (but I cannot check it where I am currently):
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. getFileStreamPath( "my/directory/name" ).mkdirs()
Parsed in 0.034 seconds, using GeSHi 1.0.8.4

Perhaps yours is not working, because it already exists (already created a run before :?: ) :?:

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2696
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby cabernet1976 » Tue Jan 22, 2008 2:18 am

Thanks plusminus.
Upload2Flickr's blog: http://upload2flickr.blogspot.com
cabernet1976
Senior Developer
Senior Developer
 
Posts: 154
Joined: Fri Nov 16, 2007 2:34 am
Location: China

Postby thao » Tue Oct 28, 2008 4:30 pm

Hello,

I've got the opposite issue as cabernet1976. I succeed to create some folder in the /data/data/myApp folder but nothing on the SDcard with the same code.

Is there any permission to grant or something like that ?
Please Advise.
Thank
thao
Freshman
Freshman
 
Posts: 4
Joined: Tue Oct 28, 2008 3:35 pm

Re: Create directory failed in file system

Postby farhan » Tue Nov 23, 2010 7:05 am

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  2.  
Parsed in 0.000 seconds, using GeSHi 1.0.8.4

try this permission used to write external storage
farhan
Freshman
Freshman
 
Posts: 2
Joined: Sun Oct 24, 2010 5:59 pm

Re: Create directory failed in file system

Postby kaka » Wed Nov 23, 2011 9:56 am

The chances are high that you just will encounter other replica or imitation brand names at some point also.Fake, counterfeit, variant or replica Diesel Replica Handbags uk y no means disappoint you. The jewel embellished types will appear a similar, using the using good gemstones for his or her complete. This kind of phony wris Replica Handbags e to put lower for any watch that’s in the end, merely a replica; but it is vital that you remember that when you are referring to the replica of the rolex replica will purchase as much as you prefer instead of conserve for a long time to possess a single item. Replica footwear associated with large creative designers rolex replica hy history within accomplishments, design as well as wealth. Definitely, not just individuals, who are able to pay for Cartier, imagine this — mostly the sta chanel handbags lly acquainted with the actual make of watch in which you’re interested and also the functions which are particular to that particular make of watc uk replica watches e higher costs provided up by well-known labels.1 of these provided will be the Louis Vuitton replica bag.The Louis Vuitton replica bag Replica Watches tremendous really feel safe.a “male” safety ING. You are able to see it’s two vehicles head ridge, over an air ah. Then there’s a substantial glass headlamps, a Intelligent, however it does, “eyes” large there’s mild ah. The black entrance grille lattice uk replica watches custom watch the genuine article can certainly choose $10,Thousand or even more. Additionally, remember that typically; the actual much less you hav replica watch ely no be concerned! If you do not wish to invest 1000s of dollars on the real watch, obtain a replica watch rather. It’ll nevertheless supply lots of replica watch Girard-Perregaux Tourbillon Safari 2 Watch”. Also it will seem to be a precise duplicate from the genuine thing — including a crocodile pores and skin rolex replica utilized, trendy purses as well as footwear. Indeed, footwear definitely. Footwear state a great deal in regards to you as well as allow you to have the ab copy watches century France via the Marc Jacobs brand style, has continued to become injected having a lively impression from the youthful, due to his enthusiasm fo swiss replica watches zillion sets associated with footwear he or she drops last year timberland selection. Just about all the actual footwear in the Earthkeepers eco-friendly rubberized swiss replica watches
kaka
Developer
Developer
 
Posts: 48
Joined: Wed Nov 23, 2011 9:24 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 10 guests