05nelsonm / kmp-file

A very simple File API for Kotlin Multiplatform. It gets the job done.
Apache License 2.0
3 stars 0 forks source link

Add `isCanonicallyEqualTo` extension function #56

Closed 05nelsonm closed 4 months ago

05nelsonm commented 8 months ago

The equal function only compares path strings. So, if file A is /some/path and file B is /some/path/more/.., they will not be "equal".

The isCanonicallyEqualTo extension function should compare 2 files whereby, in the event the path of each file is not the same, will hit both with canonicalFile() and compare them. In the event an IOException is encountered (possible with canonicalFile), then absoluteFile.normalize() should be fallen back to to compare.