directory - Java detecting directories -


good afternoon.

i'm maintaining application needs parse directories. application uses file.isdirectory() detect whether given path directory or file, recursively fetches files , sub-directories contained.

this works, unless directory name contains spaces, path c:\foo\bar detects both foo , bar directories, desired behaviour; path such c:\f oo\bar not: file.isdirectory() returns false (as file.isfile()) on such path.
on other hand, file.isabsolute() returns true - it's absolute path, neither file nor directory, according file library.

is there workaround? alternatives detect whether given path directory? or doomed running application on directories no spaces in them?

thank attention.

edit: file created rather tortuous process involving string being converted file string , file on 5-6 method calls (not code). anyway, i've located root of issue, think. i'll fix it.

should delete question? don't see being useful future users.

i tried in max os. ok

file dir = new file("/users/jinqi/downloads/is space/foo"); file dir1 = new file("/users/jinqi/downloads/is\\ space/foo"); system.out.println(dir.isdirectory()); // true system.out.println(dir1.isdirectory()); // false 

why tried is\\ space found unix terminal show path space in way.

maybe can try way in windows.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -