Removed file existence check to improve performance

This commit is contained in:
Nite 2020-10-07 20:52:58 +02:00
parent b16dde0b07
commit 1f7167e016
No known key found for this signature in database
GPG Key ID: 1D1AD59B1C6386C1
1 changed files with 3 additions and 4 deletions

View File

@ -60,11 +60,10 @@ public class FileUtil
{
File dir = getAlbumDirectory(context, song);
// If the song already exists, it isn't necessary to give it a name
if (!TextUtils.isEmpty(song.getPath()))
// Do not generate new name for offline files. Offline files will have their Path as their Id.
if (!TextUtils.isEmpty(song.getId()))
{
File songFile = new File(String.format("%s/%s", getMusicDirectory(context).getPath(), fileSystemSafeDir(song.getPath())));
if (songFile.exists() && songFile.isFile()) return songFile;
if (song.getId().startsWith(dir.getAbsolutePath())) return new File(song.getId());
}
// Generate a file name for the song