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()) for (DownloadFile downloadFile : downloader.getValue().getDownloads())
{ {
filesToNotDelete.add(downloadFile.getPartialFile()); filesToNotDelete.add(downloadFile.getPartialFile());
filesToNotDelete.add(downloadFile.getCompleteFile()); filesToNotDelete.add(downloadFile.getCompleteOrSaveFile());
} }
filesToNotDelete.add(FileUtil.getMusicDirectory(context)); filesToNotDelete.add(FileUtil.getMusicDirectory(context));

View File

@ -194,7 +194,7 @@ public class StreamProxy implements Runnable
while (isRunning && !client.isClosed()) while (isRunning && !client.isClosed())
{ {
// See if there's more to send // 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; int cbSentThisBatch = 0;
if (file.exists()) if (file.exists())

View File

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