Skip to content

Commit

Permalink
FileUtil: added sameFile(File,File) for ceylon/ceylon-runtime#53
Browse files Browse the repository at this point in the history
  • Loading branch information
FroMage committed May 6, 2014
1 parent 29e8607 commit 0959f1b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions 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 0959f1b

Please sign in to comment.