-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add ability to import data from external osu!lazer installations #35935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| using (var src = new FileStream(sourceFilePath, FileMode.Open, FileAccess.Read)) | ||
| using (var dst = destFilesStorage.CreateFileSafely(relativePath)) | ||
| { | ||
| await src.CopyToAsync(dst).ConfigureAwait(false); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably want to use RealmFileStore.Add here. It has better safeties when the destination already exists, and also allows making use of hard link support when available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay! I removed my own check for the file existing and also removed importRealmFiles since RealmFileStore.Add already adds the file's hash to the database.
One issue I came across is that the game tries to create the hard-link, but doesn't end up doing so. Both of the folders are in the same partition and using ext4. Is it because I'm using FileStream? Tried to debug for a bit but couldn't end up solving it.
using (var data = File.OpenRead(sourceFilePath))
{
realmFileStore.Add(data, destRealm, preferHardLinks: true); // Logs `Attempting to create hard-link.` (temporarliy modified the code to tell me if it's trying to create a hard link)
}$ stat ~/osu-lazer/osu-lazer/files/a/a1/a1556d0801b3a6b175dda32ef546f0ec812b400499f575c44fccbe9c67f9b1e5
File: /home/yorunoken/osu-lazer/osu-lazer/files/a/a1/a1556d0801b3a6b175dda32ef546f0ec812b400499f575c44fccbe9c67f9b1e5
Size: 988 Blocks: 8 IO Block: 4096 regular file
Device: 8,2 Inode: 41419647 Links: 1 <-- supposed to be `2`
Access: (0644/-rw-r--r--) Uid: ( 1000/yorunoken) Gid: ( 1000/yorunoken)
Access: 2025-12-09 16:20:02.611529150 +0300
Modify: 2025-12-09 16:20:02.561773813 +0300
Change: 2025-12-09 16:20:02.562294539 +0300
Birth: 2025-12-09 16:20:02.561773813 +0300
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah this is a really weird one. Until now we've been working with FileStreams returned from ArchiveReader that seem to set the stream.Name to the full path (which is then consumed here. Can you check what you're seeing in the Name property of the stream in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the issue was that sourceFilePath was a relative path, not absolute. I've fixed that now
|
This is a bit of a niche one, but also very cool that it can be done quite simply (and very isolated). I'm not against having this as a feature. |
|
There's 2 things that i think should be improved.
Also, since the import notification does not differentiate what is being imported. I'd do away with the notification spam and only use a single "files imported" one. (I think the setup wizard import does differentiate though...?) |
|
I tried to match the UX to the way osu! imports stable hence why the previous install doesn't get deleted. Since the files are hardlinked (where they can) with peppy's fix, it doesn't eat up additional disk space As for the notifications, they only looked spammy in the video because the test dataset was tiny. On a real install, the steps take actual time, so I think keeping them separate gives more transparency to the user. I also tidied up the UI so it looks a bit cleaner now:
|
|
I'm not too fussed about the deleting part, it's a decision for the osu team in the end. |
|
@yorunoken before i dive in and give a full review, can you update the UI components to use the newer "Form" component style? It doesn't make too much sense to add new screens to the game using the old style when we're trying to migrate away. |
|
was also proposing using things like |
|
I want a way to tell the user how many beatmaps are going to be imported (since it looks good and also how importing from stable works), but it's kind of awkward with the Form components because you can't change |


Solves an issue where users can't import data from a different osu!lazer install. As discussed in #35547, there is currently no way to do this.
The new importer:
client.realmfiles/folder from source folder to current folderThis takes a few minutes depending on the size of the old install, and the speed of the disk.
2025-12-08.18-49-07.mp4