
15 Apr
2021
15 Apr
'21
1:08 a.m.
I don't know how to detect whether two filepaths are in the same filesystem.
Yes you do!
If I use System.Directory.renameFile and the final location is in another filesystem, I'll get an error "renameFile:renamePath:rename: unsupported operation (Invalid cross-device link)".
And it follows that if you get no error, the two filepaths are in the same filesystem
What's the best way to move the file if possible but copy-and-delete if necessary?
Catch that error, and copy-and-delete. Donn