Hello,
i spent another several hours on this issue i'm having and i think i'm going nuts :=)
so heres the problem:
System: Mac OS, two partitions "Mac" and "DATA"
i have a file "file1.ogg" on the "main" partition (where Mac OS x resides) in the directory tecxx/Music/file1.ogg
i have a file "file2.ogg" on my NTFS data partition, in the subfolder /DJMUSIC/file2.ogg
so far, so good.
when i process these 2 files in my application with a File object and the method "getAbsolutePath()" i get:
1) /Users/tecx/Music/file1.ogg
2) /Volumes/DATA/DJMUSIC/file2.ogg
note that path 1 does not contain any volume name at all, while path 2 contains not just the volume name, but "/Volumes/" in front of the path.
allright, now here comes the problem. i have another application which uses these 2 files (a dj software). it spits out the filenames of these two tracks in an xml file with these path names:
1) /Mac/Users/tecxx/Music/file1.ogg
2) /Data/DJMUSIC/file2.ogg
Note that this application adds the Volume name to both paths, but NOT /Volumes/.
what i need to do now is match the filenames against each other. when i process the xml file of the dj app, i extract the filepath, and need to find it in my internal database of my application. but how do i do that, if java returns such strange names, one time without any volume-identifier at all, and the other time with a volume-identifier AND "/Volumes" as a prefx ?
seriously, this is bugging me for over a week now and i spent the entire day trying to fix this (manually adding "/Volumes/" to the paths, trying different combinations of getAbsolutePath, getCanonicalPath, toURL.toExternalForm; etc,etc), but isn't there an easy solution to get the volume name AND path name of a file somehow?
in short, i'd like to have a function always return something like this:
// returns /Mac/somedirectory/somename.ext
// or /Data/otherdirectory/someothername.ext
String getFullPathName(File f)
{
return f.getVolumeName() + f.getAbsolutePath();
}
but how do i do the first part (getVolumeName)?
please help or i will kill myself (just kidding :)
cheers,
robert
Edited by: tecxxtc on May 9, 2008 10:24 AM
Edited by: tecxxtc on May 9, 2008 10:24 AM