Results 1 to 4 of 4
- 01-25-2010, 11:44 AM #1
Member
- Join Date
- Jan 2010
- Posts
- 2
- Rep Power
- 0
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.
It works fine for HDs and USB units, but DVD units are threaten like normal files.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); }
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.
- 01-25-2010, 12:07 PM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Who says that "ability" exists in Java, currently?
Google JNI, maybe?
- 01-25-2010, 12:12 PM #3
Member
- Join Date
- Jan 2010
- Posts
- 2
- Rep Power
- 0
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
- 01-25-2010, 12:25 PM #4
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Similar Threads
-
Reading a properties file
By peiceonly in forum New To JavaReplies: 7Last Post: 05-06-2010, 05:17 PM -
Unable to access velocity.properties file from jar file
By mjwoodford in forum New To JavaReplies: 0Last Post: 10-09-2009, 01:46 PM -
Display Square Roots
By hypes057 in forum New To JavaReplies: 8Last Post: 08-25-2009, 10:34 AM -
26 roots
By Nicholas Jordan in forum Advanced JavaReplies: 6Last Post: 08-25-2008, 11:33 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks