Results 1 to 4 of 4
  1. #1
    JVega is offline Member
    Join Date
    Jan 2010
    Posts
    2
    Rep Power
    0

    Default Accessing to file roots and their properties

    Hi!

    I'm developping a file browser and right now I'm dealing with file roots.

    I use the "File.listRoots()" method to get the roots, but I need to process its results in one or another way depending on their type.

    This is part of my code, where I check if a directory has a parent or not. In the last case, then I suppose it's a root.

    Java Code:
            File file[] = File.getRoots();
            ...
            if (file.isDirectory()) {
                if (file.getParent() == null) {
                    System.out.println(file);
                    fileItem = new FileItemRoot(file);
                } else {
                    fileItem = new FileItemFolder(file);
                }
    It works fine for HDs and USB units, but DVD units are threaten like normal files.

    I also would like to difference between USB units and "normal" ones, as I there is a GUI to show a list with names and their respective icons.

    Could anybody help me to fix this issue? I only need to know unit's type and its properties (I only found those "file.getTotalSpace()" and "file.getFreeSpace()").

    Sincerelly,

    Juanjo.

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Who says that "ability" exists in Java, currently?

    Google JNI, maybe?

  3. #3
    JVega is offline Member
    Join Date
    Jan 2010
    Posts
    2
    Rep Power
    0

    Default

    Well, I didn't say that "ability" exists or not, I just wanted to develop that under java.

    Anyway, since I registered at this forum a "search" option appeared :D. I checked previous answers to similar issues and I think I'll move to a different approach since I can't find a cross-platform solution for this.

    Hope they'll include more options to handle file roots in future versions.

    Thanks, man

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    "File" and "Path" abilities are increased in Java 7, but, I don't believe this is included.

Similar Threads

  1. Reading a properties file
    By peiceonly in forum New To Java
    Replies: 7
    Last Post: 05-06-2010, 05:17 PM
  2. Unable to access velocity.properties file from jar file
    By mjwoodford in forum New To Java
    Replies: 0
    Last Post: 10-09-2009, 01:46 PM
  3. Display Square Roots
    By hypes057 in forum New To Java
    Replies: 8
    Last Post: 08-25-2009, 10:34 AM
  4. 26 roots
    By Nicholas Jordan in forum Advanced Java
    Replies: 6
    Last Post: 08-25-2008, 11:33 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •