Skip to content

Commit

Permalink
fix archive updating (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
kookxiang committed Dec 1, 2024
1 parent fbb0f43 commit 8fb72b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Jellyfin.Plugin.Bangumi/Archive/ArchiveController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public class OAuthController(ArchiveData archive)
DateTime? lastModifyTime = null;

var directory = new DirectoryInfo(archive.BasePath);
if (!directory.Exists)
return [];

foreach (var info in directory.GetFileSystemInfos("*", SearchOption.AllDirectories))
{
if (lastModifyTime == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ private async Task Save()

writer.Flush();
await outStream.FlushAsync();
outStream.Close();

if (File.Exists(FilePath))
File.Move(FilePath, Path.Join(archive.TempPath, Path.GetRandomFileName()), true);
File.Move(tempFilePath, FilePath, true);
}
}

0 comments on commit 8fb72b4

Please sign in to comment.