mkdir

R

Roedy Green

The docs don't talk about what happens in various situations where you
create a file when the directory it belongs to does not exist yet.

If this is a possibility, are you supposed to use mkdirs first?
 
H

Harald Hein

Roedy Green said:
The docs don't talk about what happens in various situations where
you create a file when the directory it belongs to does not exist
yet.

You get an IOException.
If this is a possibility, are you supposed to use mkdirs first?

Yes, if you want to enforce that the file can be written. However, if
you use a GUI file chooser, the user usually can create the directory
himself using the file chooser, so you can skip that code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top