aspose file tools*
The moose likes Java in General and the fly likes Windows File Paths Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Windows File Paths" Watch "Windows File Paths" New topic
Author

Windows File Paths

Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3707
    
    5

Is there a quick way in java to determine if two file paths are equivalent on a windows based system if their format is different such as:

C:\Program Files\MyFile.exe
C:\PROGRA~1\MyFile.exe

I've tried using File getCanonicalPath() but it didn't work.
[ September 19, 2006: Message edited by: Scott Selikoff ]

My Blog: Down Home Country Coding with Scott Selikoff
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1817


I didn't have a "MyFile.exe" to test it out with, but this worked. (Java 1.4.2_04)


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3707
    
    5

Maybe I made a mistake debugging/testing, I'll try it again.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Windows File Paths