I'm trying to create a directory using File.mkdir() (and File.mkdirs()) but neither works! I don't get an exception, and mkdir returns true but when I check the file system no directory has been created and this is driving me up the wall!
Often files may not be located where you think they are - especially if the path is relative. Do you know for sure what the current working directory is when the code is executing? That's what your Java uses as the base, when evaluating relative paths. I suggest
to make sure you know what path the File is referring to. I suspect you'll find that the directory is getting created, but not where you expect.
"I'm not back." - Bill Harding, Twister
posted 15 years ago
Originally posted by Jim Yingst: Often files may not be located where you think they are - especially if the path is relative.
Hi, yes good idea but I'd already thought of that one: firstly I use absolute paths to create and also log the paths being used to create the dirs and to make extra sure I simplified the path to /trash (so it should have created /trash/backup) but still no joy.
Originally posted by Ernest Friedman-Hill: I wonder if this is a Mac-specific issue. Would you like me to move this thread to our Java-on-Mac forum?
I was wondering the same thing and then I thought "hmm I've wrapped my mkdirs in asserts()" and yes lo and behold the reason why the dirs weren't being called is because mkdir was never called. [ October 02, 2004: Message edited by: Edward Kenworthy ]