Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
FileUtil: added sameFile(File,File) for #4848
Browse files Browse the repository at this point in the history
  • Loading branch information
FroMage committed May 6, 2014
1 parent 1bcc6f1 commit d3a9803
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions common/src/com/redhat/ceylon/common/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,18 @@ public static String relativeFile(Iterable<? extends File> paths, String file){
return path;
}

public static boolean sameFile(File a, File b) {
if(a == null)
return b == null;
if(b == null)
return false;
try {
String aPath = a.getCanonicalPath();
String bPath = b.getCanonicalPath();
return aPath.equals(bPath);
} catch (IOException e) {
return a.equals(b);
}
}

}

0 comments on commit d3a9803

Please sign in to comment.