Skip to content

Commit

Permalink
[MSHARED-1122] FileUtils: avoid getCanonicalPath()
Browse files Browse the repository at this point in the history
Use java.nio.Files.isSameFile() to compare path. Since JDK 12
getCanonicalPath() is not cached anymore and very slow on windows.
  • Loading branch information
EcljpseB0T authored and slawekjaranowski committed Sep 13, 2022
1 parent f4b0384 commit 40af112
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ public static void copyFile( @Nonnull final File source, @Nonnull final File des
}

//check source != destination, see PLXUTILS-10
if ( source.getCanonicalPath().equals( destination.getCanonicalPath() ) )
if ( destination.exists() && Files.isSameFile( source.toPath(), destination.toPath() ) )
{
//if they are equal, we can exit the method without doing any work
return;
Expand Down

0 comments on commit 40af112

Please sign in to comment.