1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-24 01:33:47 +08:00

Revert "Add a toggle for checking overwriting"

This reverts commit b7883f18be.
This commit is contained in:
smallketchup82
2024-10-11 16:15:57 -04:00
Unverified
parent 2b7eb5626c
commit 0dc77a70e1
2 changed files with 10 additions and 12 deletions
+7 -10
View File
@@ -81,19 +81,16 @@ namespace osu.Game.Database
}
/// <summary>
/// Add a file from within an ongoing realm transaction. If the file already exists, it is overwritten so long as <paramref name="overwrite"/> is true.
/// Add a file from within an ongoing realm transaction. If the file already exists, it is overwritten.
/// </summary>
public void AddFile(TModel item, Stream contents, string filename, Realm realm, bool overwrite = true)
public void AddFile(TModel item, Stream contents, string filename, Realm realm)
{
if (overwrite)
{
var existing = item.GetFile(filename);
var existing = item.GetFile(filename);
if (existing != null)
{
ReplaceFile(existing, contents, realm);
return;
}
if (existing != null)
{
ReplaceFile(existing, contents, realm);
return;
}
var file = realmFileStore.Add(contents, realm);
+3 -2
View File
@@ -59,7 +59,6 @@ namespace osu.Game.Skinning
skinInfoLive.PerformWrite(skinInfo =>
{
// Not sure if this deletes the files from the storage or just the database.
skinInfo.Files.Clear();
string[] filesInMountedDirectory = Directory.EnumerateFiles(task.Path, "*.*", SearchOption.AllDirectories).Select(f => Path.GetRelativePath(task.Path, f)).ToArray();
@@ -68,7 +67,9 @@ namespace osu.Game.Skinning
{
using var stream = File.OpenRead(Path.Combine(task.Path, file));
modelManager.AddFile(original, stream, file, Realm.Realm, false);
// The GetFile call in this method is *really* expensive, and we are certain that the file does not exist in the skin yet.
// Consider adding a method to add a file without checking if it already exists. Or add the file directly to the skin.
modelManager.AddFile(original, stream, file);
}
});