mirror of
https://github.com/ppy/osu.git
synced 2026-05-23 19:40:09 +08:00
Revert "Add a toggle for checking overwriting"
This reverts commit b7883f18be.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user