Skip to content

Commit

Permalink
Merge pull request #181 from ravener/linux-icons
Browse files Browse the repository at this point in the history
add multi-resolution icons to AppImage
  • Loading branch information
peppy authored Nov 18, 2024
2 parents 2906094 + b32d869 commit 937ed19
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 4 deletions.
32 changes: 29 additions & 3 deletions Builders/LinuxBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,40 @@ public override Uploader CreateUploader()
return new LinuxVelopackUploader(app_name, os_name, RuntimeIdentifier, RuntimeIdentifier, extraArgs: extra_args, stagingPath: stagingTarget);
}

// https://learn.microsoft.com/en-us/dotnet/standard/io/how-to-copy-directories
static void CopyDirectory(string sourceDir, string destinationDir, bool recursive)
{
var dir = new DirectoryInfo(sourceDir);

if (!dir.Exists)
throw new DirectoryNotFoundException($"Source directory not found: {dir.FullName}");

DirectoryInfo[] dirs = dir.GetDirectories();

Directory.CreateDirectory(destinationDir);

foreach (FileInfo file in dir.GetFiles())
{
string targetFilePath = Path.Combine(destinationDir, file.Name);
file.CopyTo(targetFilePath);
}

if (recursive)
{
foreach (DirectoryInfo subDir in dirs)
{
string newDestinationDir = Path.Combine(destinationDir, subDir.Name);
CopyDirectory(subDir.FullName, newDestinationDir, true);
}
}
}

public override void Build()
{
if (Directory.Exists(stagingTarget))
Directory.Delete(stagingTarget, true);
Directory.CreateDirectory(stagingTarget);

foreach (var file in Directory.GetFiles(Path.Combine(Program.TemplatesPath, app_dir)))
new FileInfo(file).CopyTo(Path.Combine(stagingTarget, Path.GetFileName(file)));
CopyDirectory(Path.Combine(Program.TemplatesPath, app_dir), stagingTarget, true);

Program.RunCommand("chmod", $"+x {stagingTarget}/AppRun");

Expand Down
2 changes: 1 addition & 1 deletion templates/osu!.AppDir/osu!.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Version=1.5
Type=Application
Name=osu!
Comment=A free-to-win rhythm game. Rhythm is just a *click* away!
Icon=osu!
Icon=osu
Exec=osu! %u
Terminal=false
MimeType=application/x-osu-beatmap-archive;application/x-osu-skin-archive;application/x-osu-beatmap;application/x-osu-storyboard;application/x-osu-replay;x-scheme-handler/osu;
Expand Down
Binary file added templates/osu!.AppDir/osu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 937ed19

Please sign in to comment.