Boolean areOnDifferentVolumes ( File srcFile , File targetFile ) throws RolloverFailure { if ( ! EnvUtil . isJDK7OrHigher ( ) ) { return false ; } // target file is not certain to exist but its parent has to exist given the call hierarchy of this method File parentOfTarget = targetFile . getAbsoluteFile ( ) . getParentFile ( ) ; if ( parentOfTarget == null ) { addWarn ( "Parent of target file [" + targetFile + "] is null" ) ; return null ; } if ( ! parentOfTarget . exists ( ) ) { addWarn ( "Parent of target file [" + targetFile + "] does not exist" ) ; return null ; } try { boolean onSameFileStore = FileStoreUtil . areOnSameFileStore ( srcFile , parentOfTarget ) ; return ! onSameFileStore ; } catch ( RolloverFailure rf ) { addWarn ( "Error while checking file store equality" , rf ) ; return null ; } }
Attempts tp determine whether both files are on different volumes . Returns true if we could determine that the files are on different volumes . Returns false otherwise or if an error occurred while doing the check .