1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:07:52 +08:00

Ensure reading of existing databases when making backups doesn't create a file

This commit is contained in:
Dean Herbert 2022-06-16 16:48:06 +09:00
parent 1c3cc985bc
commit 739a696467
2 changed files with 2 additions and 2 deletions

View File

@ -151,7 +151,7 @@ namespace osu.Game.Database
{ {
Logger.Log($"Creating full EF database backup at {backupFilename}", LoggingTarget.Database); Logger.Log($"Creating full EF database backup at {backupFilename}", LoggingTarget.Database);
using (var source = storage.GetStream(DATABASE_NAME)) using (var source = storage.GetStream(DATABASE_NAME, mode: FileMode.Open))
using (var destination = storage.GetStream(backupFilename, FileAccess.Write, FileMode.CreateNew)) using (var destination = storage.GetStream(backupFilename, FileAccess.Write, FileMode.CreateNew))
source.CopyTo(destination); source.CopyTo(destination);
} }

View File

@ -762,7 +762,7 @@ namespace osu.Game.Database
{ {
try try
{ {
using (var source = storage.GetStream(Filename)) using (var source = storage.GetStream(Filename, mode: FileMode.Open))
using (var destination = storage.GetStream(backupFilename, FileAccess.Write, FileMode.CreateNew)) using (var destination = storage.GetStream(backupFilename, FileAccess.Write, FileMode.CreateNew))
source.CopyTo(destination); source.CopyTo(destination);
return; return;