Skip to content

Commit

Permalink
dont check file existence
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <alper_ozturk@proton.me>
  • Loading branch information
alperozturk96 committed Sep 30, 2024
1 parent aadc652 commit b071684
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,14 @@ class InternalTwoWaySyncWork(
private fun checkFreeSpace(folder: OCFile): Result? {
folder.storagePath?.let { storagePath ->
val file = File(storagePath)
if (file.exists()) {
val freeSpaceLeft = file.getFreeSpace()
val localFolder = File(storagePath, MainApp.getDataFolder())
val localFolderSize = FileStorageUtils.getFolderSize(localFolder)
val remoteFolderSize = folder.fileLength

if (freeSpaceLeft < (remoteFolderSize - localFolderSize)) {
Log_OC.d(TAG, "Not enough space left!")
return Result.failure()
}
val freeSpaceLeft = file.getFreeSpace()
val localFolder = File(storagePath, MainApp.getDataFolder())
val localFolderSize = FileStorageUtils.getFolderSize(localFolder)
val remoteFolderSize = folder.fileLength

if (freeSpaceLeft < (remoteFolderSize - localFolderSize)) {
Log_OC.d(TAG, "Not enough space left!")
return Result.failure()
}
}

Expand Down

0 comments on commit b071684

Please sign in to comment.