[brailleblaster] Re: Michael, Why aren't the direcories being created?

  • From: "Michael Whapples" <mwhapples@xxxxxxx>
  • To: <brailleblaster@xxxxxxxxxxxxx>
  • Date: Tue, 13 Mar 2012 11:18:12 -0000

Thanks for keeping me on my toes as far as Java goes. Recently I have not been writing as much code as I want and probably small subtle things I may never even think about but may be important for explaining to others could get forgotten if it were not for the continual questions.


Michael Whapples

-----Original Message----- From: John J. Boyer
Sent: Tuesday, March 13, 2012 10:53 AM
To: brailleblaster@xxxxxxxxxxxxx
Subject: [brailleblaster] Re: Michael, Why aren't the direcories being created?

mkdirs() did the trick. The directories are all present on my Linux
development system. I'm thinking of other changes, so I'll hold off on a
push, since everybody who is actively participating on development on
Windows has already created the directories.

Thanks< Michael for the link and the information. I guess you are our
Java guru.

John

On Tue, Mar 13, 2012 at 09:52:20AM -0000, Michael Whapples wrote:
Here are some notes, you may want to read the javadoc for the java.io.File
class http://docs.oracle.com/javase/1.5.0/docs/api/java/io/File.html

Firstly how are you creating the directory? Please remember that the
mkdir() method will not create any required parent directories, if a parent
directory does not exist then it will fail. Could this be the problem? If
it is overcome it either by manually creating the parent directories or
just use the mkdirs() method instead (mkdirs() will create any required
parent directories for you), bear in mind though mkdirs() even if it fails
may have created some of the parent directories, if that is important to
know then manually creating the parent directories might be required. The
difference between mkdir() and mkdirs() caught out orca developers as well
and lead to a similar problem, however as orca is python I cannot compare
the exceptions raised.

Also I am not sure what the situation is regarding creating the directory
names, might you be getting multiple separators? While I think java can
swallow these without trouble, you may want to look at options like the
constructor File(String parent, String child) which will join the parent
path and child path for you. Oh why java cannot have a join method like
python for joining whole lists of parts of file/path names rather than this
constructor which oly takes two parts.

Moving to Java7 would be unlikely to offer anything here I think.

Michael Whapples

-----Original Message----- From: John J. Boyer
Sent: Tuesday, March 13, 2012 9:26 AM
To: brailleblaster@xxxxxxxxxxxxx
Subject: [brailleblaster] Michael, Why aren't the direcories being created?

I wrote the code in BBIni.java early and didn't know much about the File
class. So I used a system property to get the file separator. Later I
used the File class to create the settings and temp directories. This
worked fine with the initial paths. Now the directories aren't created
even in Linux, where the paths are much shorter than for Windows. Does
Java have a limit  on the length of apths or on the number of elements
they can contain? Would using Java 7 improve the situation?

Thanks,
John

--
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities



--
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities



Other related posts: