Rename a function semantically

This commit is contained in:
tzugen 2021-04-17 12:25:21 +02:00
parent a97cb30d1c
commit d9d82b77d4
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930
3 changed files with 8 additions and 11 deletions

View File

@ -229,7 +229,7 @@ public class CacheCleaner
for (DownloadFile downloadFile : downloader.getValue().getDownloads())
{
filesToNotDelete.add(downloadFile.getPartialFile());
filesToNotDelete.add(downloadFile.getCompleteFile());
filesToNotDelete.add(downloadFile.getCompleteOrSaveFile());
}
filesToNotDelete.add(FileUtil.getMusicDirectory(context));

View File

@ -194,7 +194,7 @@ public class StreamProxy implements Runnable
while (isRunning && !client.isClosed())
{
// See if there's more to send
File file = downloadFile.isCompleteFileAvailable() ? downloadFile.getCompleteFile() : downloadFile.getPartialFile();
File file = downloadFile.isCompleteFileAvailable() ? downloadFile.getCompleteOrSaveFile() : downloadFile.getPartialFile();
int cbSentThisBatch = 0;
if (file.exists())

View File

@ -100,19 +100,16 @@ class DownloadFile(
}
}
fun getCompleteFile(): File {
if (saveFile.exists()) {
return saveFile
}
return if (completeFile.exists()) {
val completeOrSaveFile: File
get() = if (saveFile.exists()) {
saveFile
} else {
completeFile
} else saveFile
}
}
val completeOrPartialFile: File
get() = if (isCompleteFileAvailable) {
getCompleteFile()
completeOrSaveFile
} else {
partialFile
}