Is there a cleaner way in getting the root directory name, drive letter, or computer name of a given directory other than string manipulation?
For example:
C:\myfolder\file.txt will return C:\
//NETWORK_COMPUTER/myfolder/file.txt will return //NETWORK_COMPUTER/
/temp/myfolder/file.txt will return /temp/
Note: I have already checked Get partition name from drive letter and vice versa and Fetching file and path from network using java.
Also, this problem is restricted to JDK 6