mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-11 18:39:43 +07:00
Fix Mod unpack folder move (#5346)
* Fix Mod unpack folder move * Fix Mod unpack folder move - comment
This commit is contained in:
parent
bb5825a325
commit
4c87d98aaa
@ -107,10 +107,18 @@ object Github {
|
||||
|
||||
return finalDestination
|
||||
}
|
||||
|
||||
|
||||
private fun FileHandle.renameOrMove(dest: FileHandle) {
|
||||
// Gdx tries a java rename for Absolute and External, but NOT for Local - rectify that
|
||||
if (type() == Files.FileType.Local && file().renameTo(dest.file())) return
|
||||
if (type() == Files.FileType.Local) {
|
||||
// See #5346: renameTo 'unpacks' a source folder if the destination exists and is an
|
||||
// empty folder, dropping the name of the source entirely.
|
||||
// Safer to ask for a move to the not-yet-existing full resulting path instead.
|
||||
if (isDirectory)
|
||||
if (file().renameTo(dest.child(name()).file())) return
|
||||
else
|
||||
if (file().renameTo(dest.file())) return
|
||||
}
|
||||
moveTo(dest)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user