1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-26 22:46:53 -04:00

Fixed: Renaming episodes on OSX with case-insensitive filesystem.

This commit is contained in:
Taloth Saldono
2015-06-27 01:01:33 +02:00
parent bd222dbd95
commit c9f720885e
3 changed files with 89 additions and 8 deletions
@@ -97,11 +97,11 @@ namespace NzbDrone.Core.MediaFiles
return TransferFile(episodeFile, localEpisode.Series, localEpisode.Episodes, filePath, TransferMode.Copy);
}
private EpisodeFile TransferFile(EpisodeFile episodeFile, Series series, List<Episode> episodes, string destinationFilename, TransferMode mode)
private EpisodeFile TransferFile(EpisodeFile episodeFile, Series series, List<Episode> episodes, string destinationFilePath, TransferMode mode)
{
Ensure.That(episodeFile, () => episodeFile).IsNotNull();
Ensure.That(series,() => series).IsNotNull();
Ensure.That(destinationFilename, () => destinationFilename).IsValidPath();
Ensure.That(destinationFilePath, () => destinationFilePath).IsValidPath();
var episodeFilePath = episodeFile.Path ?? Path.Combine(series.Path, episodeFile.RelativePath);
@@ -110,14 +110,14 @@ namespace NzbDrone.Core.MediaFiles
throw new FileNotFoundException("Episode file path does not exist", episodeFilePath);
}
if (episodeFilePath.PathEquals(destinationFilename))
if (episodeFilePath == destinationFilePath)
{
throw new SameFilenameException("File not moved, source and destination are the same", episodeFilePath);
}
_diskTransferService.TransferFile(episodeFilePath, destinationFilename, mode);
_diskTransferService.TransferFile(episodeFilePath, destinationFilePath, mode);
episodeFile.RelativePath = series.Path.GetRelativePath(destinationFilename);
episodeFile.RelativePath = series.Path.GetRelativePath(destinationFilePath);
_updateEpisodeFileService.ChangeFileDateForFile(episodeFile, series, episodes);
@@ -127,7 +127,7 @@ namespace NzbDrone.Core.MediaFiles
if (series.SeasonFolder)
{
var seasonFolder = Path.GetDirectoryName(destinationFilename);
var seasonFolder = Path.GetDirectoryName(destinationFilePath);
_mediaFileAttributeService.SetFolderLastWriteTime(seasonFolder, episodeFile.DateAdded);
}
@@ -138,7 +138,7 @@ namespace NzbDrone.Core.MediaFiles
_logger.WarnException("Unable to set last write time", ex);
}
_mediaFileAttributeService.SetFilePermissions(destinationFilename);
_mediaFileAttributeService.SetFilePermissions(destinationFilePath);
return episodeFile;
}