mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 05:22:54 +08:00
Add warning message in files
folder to avoid accidental deletion
This is a pretty standard practice for applications that have data stored in folders where a user may accidentally determine that the content is unnecessary. Aims to address cases like https://github.com/ppy/osu/discussions/20394#discussioncomment-3705694. It's not the first time this has come up, and definitely won't be the last.
This commit is contained in:
parent
e3cf764909
commit
db21601632
@ -5,6 +5,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
@ -255,6 +256,8 @@ namespace osu.Game
|
||||
|
||||
InitialiseFonts();
|
||||
|
||||
addFilesWarning();
|
||||
|
||||
Audio.Samples.PlaybackConcurrency = SAMPLE_CONCURRENCY;
|
||||
|
||||
dependencies.Cache(SkinManager = new SkinManager(Storage, realm, Host, Resources, Audio, Scheduler));
|
||||
@ -373,6 +376,29 @@ namespace osu.Game
|
||||
Beatmap.BindValueChanged(onBeatmapChanged);
|
||||
}
|
||||
|
||||
private void addFilesWarning()
|
||||
{
|
||||
var realmStore = new RealmFileStore(realm, Storage);
|
||||
|
||||
const string filename = "IMPORTANT READ ME.txt";
|
||||
|
||||
if (!realmStore.Storage.Exists(filename))
|
||||
{
|
||||
using (var stream = realmStore.Storage.CreateFileSafely(filename))
|
||||
using (var textWriter = new StreamWriter(stream))
|
||||
{
|
||||
textWriter.WriteLine(@"This folder contains all your user files (beatmaps, skins, replays etc.)");
|
||||
textWriter.WriteLine(@"Please do not touch or delete this folder!!");
|
||||
textWriter.WriteLine();
|
||||
textWriter.WriteLine(@"If you are really looking to completely delete user data, please delete");
|
||||
textWriter.WriteLine(@"the parent folder including all other files and directories");
|
||||
textWriter.WriteLine();
|
||||
textWriter.WriteLine(@"For more information on how these files are organised,");
|
||||
textWriter.WriteLine(@"see https://github.com/ppy/osu/wiki/User-file-storage");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onTrackChanged(WorkingBeatmap beatmap, TrackChangeDirection direction)
|
||||
{
|
||||
// FramedBeatmapClock uses a decoupled clock internally which will mutate the source if it is an `IAdjustableClock`.
|
||||
|
Loading…
Reference in New Issue
Block a user