aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Ui.Common/Helper/ShortcutHelper.cs
diff options
context:
space:
mode:
authorNitroTears <73270647+NitroTears@users.noreply.github.com>2023-11-12 01:08:42 +1000
committerGitHub <noreply@github.com>2023-11-11 16:08:42 +0100
commit55557525b16f8256d91f769e026874b5c70c3b2d (patch)
tree6b56d9c8a8f4c59010c923975a6b91f1dbaed5f8 /src/Ryujinx.Ui.Common/Helper/ShortcutHelper.cs
parent7e6342e44ddb004b0600f6bb4e6169aba6e4bf7c (diff)
Create Desktop Shortcut fixes (#5852)1.1.1075
* remove duplicate basePath arg, add --fullscreen arg * Changing FriendlyName to set "Ryujinx" text * Fix GetArgsString using the base path * Change desktop path to the Applications folder when creating shortcut on Mac Co-authored-by: Nicko Anastassiu <134955950+nickoanastassiu@users.noreply.github.com> * Move Create Shortcut button to top of context menu --------- Co-authored-by: TSR Berry <20988865+TSRBerry@users.noreply.github.com> Co-authored-by: Nicko Anastassiu <134955950+nickoanastassiu@users.noreply.github.com>
Diffstat (limited to 'src/Ryujinx.Ui.Common/Helper/ShortcutHelper.cs')
-rw-r--r--src/Ryujinx.Ui.Common/Helper/ShortcutHelper.cs18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/Ryujinx.Ui.Common/Helper/ShortcutHelper.cs b/src/Ryujinx.Ui.Common/Helper/ShortcutHelper.cs
index dab473fa..103b78c2 100644
--- a/src/Ryujinx.Ui.Common/Helper/ShortcutHelper.cs
+++ b/src/Ryujinx.Ui.Common/Helper/ShortcutHelper.cs
@@ -30,7 +30,7 @@ namespace Ryujinx.Ui.Common.Helper
graphic.DrawImage(image, 0, 0, 128, 128);
SaveBitmapAsIcon(bitmap, iconPath);
- var shortcut = Shortcut.CreateShortcut(basePath, GetArgsString(basePath, applicationFilePath), iconPath, 0);
+ var shortcut = Shortcut.CreateShortcut(basePath, GetArgsString(applicationFilePath), iconPath, 0);
shortcut.StringData.NameString = cleanedAppName;
shortcut.WriteToFile(Path.Combine(desktopPath, cleanedAppName + ".lnk"));
}
@@ -46,16 +46,16 @@ namespace Ryujinx.Ui.Common.Helper
image.SaveAsPng(iconPath);
using StreamWriter outputFile = new(Path.Combine(desktopPath, cleanedAppName + ".desktop"));
- outputFile.Write(desktopFile, cleanedAppName, iconPath, GetArgsString(basePath, applicationFilePath));
+ outputFile.Write(desktopFile, cleanedAppName, iconPath, $"{basePath} {GetArgsString(applicationFilePath)}");
}
[SupportedOSPlatform("macos")]
private static void CreateShortcutMacos(string appFilePath, byte[] iconData, string desktopPath, string cleanedAppName)
{
- string basePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, AppDomain.CurrentDomain.FriendlyName);
+ string basePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Ryujinx");
var plistFile = EmbeddedResources.ReadAllText("Ryujinx.Ui.Common/shortcut-template.plist");
// Macos .App folder
- string contentFolderPath = Path.Combine(desktopPath, cleanedAppName + ".app", "Contents");
+ string contentFolderPath = Path.Combine("/Applications", cleanedAppName + ".app", "Contents");
string scriptFolderPath = Path.Combine(contentFolderPath, "MacOS");
if (!Directory.Exists(scriptFolderPath))
@@ -69,7 +69,7 @@ namespace Ryujinx.Ui.Common.Helper
using StreamWriter scriptFile = new(scriptPath);
scriptFile.WriteLine("#!/bin/sh");
- scriptFile.WriteLine(GetArgsString(basePath, appFilePath));
+ scriptFile.WriteLine($"{basePath} {GetArgsString(appFilePath)}");
// Set execute permission
FileInfo fileInfo = new(scriptPath);
@@ -125,13 +125,10 @@ namespace Ryujinx.Ui.Common.Helper
throw new NotImplementedException("Shortcut support has not been implemented yet for this OS.");
}
- private static string GetArgsString(string basePath, string appFilePath)
+ private static string GetArgsString(string appFilePath)
{
// args are first defined as a list, for easier adjustments in the future
- var argsList = new List<string>
- {
- basePath,
- };
+ var argsList = new List<string>();
if (!string.IsNullOrEmpty(CommandLineState.BaseDirPathArg))
{
@@ -141,7 +138,6 @@ namespace Ryujinx.Ui.Common.Helper
argsList.Add($"\"{appFilePath}\"");
-
return String.Join(" ", argsList);
}