Skip to content

Commit cbda23f

Browse files
authored
Rename linux desktop files (#523)
The desktop file entry spec states that only alpha-numeric characters, dashes, and underscores are valid in desktop file names. The WPILib installer created files with spaces and parentheses, which caused issues for me when trying to launch any apps. This PR simply replaces spaces with underscores and removes the parentheses in just the file name, the actual display name is not changed.
1 parent 99b6e60 commit cbda23f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

WPILibInstaller-Avalonia/ViewModels/InstallPageViewModel.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class InstallPageViewModel : PageViewModelBase
3333

3434
private async void CreateLinuxShortcut(String name, String frcYear, String wmClass, CancellationToken token)
3535
{
36-
var launcherFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local/share/applications", $@"{name} {frcYear}.desktop");
36+
var launcherFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local/share/applications", $@"{name.Replace(' ', '_').Replace(")", "").Replace("(", "")}_{frcYear}.desktop");
3737
string contents;
3838
if (name.Contains("WPILib"))
3939
{
@@ -1001,7 +1001,7 @@ await MessageBox.Avalonia.MessageBoxManager.GetMessageBoxStandardWindow(new Mess
10011001
{
10021002
// Create Linux desktop shortcut
10031003
var desktopFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Desktop", $@"FRC VS Code {frcYear}.desktop");
1004-
var launcherFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local/share/applications", $@"FRC VS Code {frcYear}.desktop");
1004+
var launcherFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local/share/applications", $@"FRC_VS_Code_{frcYear}.desktop");
10051005
string contents = $@"#!/usr/bin/env xdg-open
10061006
[Desktop Entry]
10071007
Version=1.0

0 commit comments

Comments
 (0)