1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 09:23:06 +08:00

Move backups to "backups" subfolder to make them easier to find

This commit is contained in:
Dean Herbert 2022-01-27 14:39:07 +09:00
parent b745252962
commit 08948f60f3

View File

@ -202,16 +202,18 @@ namespace osu.Game
// See https://github.com/ppy/osu/pull/16547 for more discussion. // See https://github.com/ppy/osu/pull/16547 for more discussion.
if (EFContextFactory != null) if (EFContextFactory != null)
{ {
const string backup_folder = "backups";
string migration = $"before_final_migration_{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}"; string migration = $"before_final_migration_{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}";
EFContextFactory.CreateBackup($"client.{migration}.db"); EFContextFactory.CreateBackup(Path.Combine(backup_folder, $"client.{migration}.db"));
realm.CreateBackup($"client.{migration}.realm"); realm.CreateBackup(Path.Combine(backup_folder, $"client.{migration}.realm"));
using (var source = Storage.GetStream("collection.db")) using (var source = Storage.GetStream("collection.db"))
{ {
if (source != null) if (source != null)
{ {
using (var destination = Storage.GetStream($"collection.{migration}.db", FileAccess.Write, FileMode.CreateNew)) using (var destination = Storage.GetStream(Path.Combine(backup_folder, $"collection.{migration}.db"), FileAccess.Write, FileMode.CreateNew))
source.CopyTo(destination); source.CopyTo(destination);
} }
} }