@@ -31,6 +31,52 @@ public class InstallPageViewModel : PageViewModelBase
31
31
public int ProgressTotal { get ; set ; }
32
32
public string TextTotal { get ; set ; } = "" ;
33
33
34
+ private async void CreateLinuxShortcut ( String name , String frcYear , CancellationToken token )
35
+ {
36
+ var launcherFile = Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) , ".local/share/applications" , $@ "{ name } { frcYear } .desktop") ;
37
+ string contents ;
38
+ if ( name . Contains ( "WPILib" ) )
39
+ {
40
+ var nameNoWPILib = name . Remove ( name . Length - " (WPILib)" . Length ) ;
41
+ contents = $@ "#!/usr/bin/env xdg-open
42
+ [Desktop Entry]
43
+ Version=1.0
44
+ Type=Application
45
+ Categories=Robotics
46
+ Name={ name } { frcYear }
47
+ Comment={ nameNoWPILib } tool for the 2025 FIRST Robotics Competition season
48
+ Exec={ configurationProvider . InstallDirectory } /tools/{ nameNoWPILib } .sh
49
+ Icon={ configurationProvider . InstallDirectory } /frccode/wpilib-256.ico
50
+ Terminal=false
51
+ StartupNotify=true
52
+ StartupWMClass=Code
53
+ " ;
54
+
55
+ }
56
+ else
57
+ {
58
+ contents = $@ "#!/usr/bin/env xdg-open
59
+ [Desktop Entry]
60
+ Version=1.0
61
+ Type=Application
62
+ Categories=Development
63
+ Name={ name } { frcYear }
64
+ Comment={ name } tool for the 2025 FIRST Robotics Competition season
65
+ Exec={ configurationProvider . InstallDirectory } /tools/{ name } .sh
66
+ Icon={ configurationProvider . InstallDirectory } /frccode/wpilib-256.ico
67
+ Terminal=false
68
+ StartupNotify=true
69
+ StartupWMClass=Code
70
+ " ;
71
+ }
72
+ var launcherPath = Path . GetDirectoryName ( launcherFile ) ;
73
+ if ( launcherPath != null )
74
+ {
75
+ Directory . CreateDirectory ( launcherPath ) ;
76
+ }
77
+ await File . WriteAllTextAsync ( launcherFile , contents , token ) ;
78
+ }
79
+
34
80
public async Task UIUpdateTask ( CancellationToken token )
35
81
{
36
82
while ( ! token . IsCancellationRequested )
@@ -894,10 +940,12 @@ await MessageBox.Avalonia.MessageBoxManager.GetMessageBoxStandardWindow(new Mess
894
940
}
895
941
else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) && vsInstallProvider . Model . InstallingVsCode )
896
942
{
897
- // Create Linux desktop shortcut
898
- var desktopFile = Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) , "Desktop" , $@ "FRC VS Code { frcYear } .desktop") ;
899
- var launcherFile = Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) , ".local/share/applications" , $@ "FRC VS Code { frcYear } .desktop") ;
900
- string contents = $@ "#!/usr/bin/env xdg-open
943
+ if ( vsInstallProvider . Model . InstallingVsCode )
944
+ {
945
+ // Create Linux desktop shortcut
946
+ var desktopFile = Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) , "Desktop" , $@ "FRC VS Code { frcYear } .desktop") ;
947
+ var launcherFile = Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) , ".local/share/applications" , $@ "FRC VS Code { frcYear } .desktop") ;
948
+ string contents = $@ "#!/usr/bin/env xdg-open
901
949
[Desktop Entry]
902
950
Version=1.0
903
951
Type=Application
@@ -911,29 +959,42 @@ [Desktop Entry]
911
959
StartupWMClass=Code
912
960
" ;
913
961
914
- var desktopPath = Path . GetDirectoryName ( desktopFile ) ;
915
- if ( desktopPath != null )
916
- {
917
- Directory . CreateDirectory ( desktopPath ) ;
918
- }
919
- var launcherPath = Path . GetDirectoryName ( launcherFile ) ;
920
- if ( launcherPath != null )
921
- {
922
- Directory . CreateDirectory ( launcherPath ) ;
923
- }
924
- await File . WriteAllTextAsync ( desktopFile , contents , token ) ;
925
- await File . WriteAllTextAsync ( launcherFile , contents , token ) ;
926
- await Task . Run ( ( ) =>
927
- {
928
- var startInfo = new ProcessStartInfo ( "chmod" , $ "+x \" { desktopFile } \" ")
962
+ var desktopPath = Path . GetDirectoryName ( desktopFile ) ;
963
+ if ( desktopPath != null )
929
964
{
930
- UseShellExecute = false ,
931
- WindowStyle = ProcessWindowStyle . Hidden ,
932
- CreateNoWindow = true
933
- } ;
934
- var proc = Process . Start ( startInfo ) ;
935
- proc ! . WaitForExit ( ) ;
936
- } , token ) ;
965
+ Directory . CreateDirectory ( desktopPath ) ;
966
+ }
967
+ var launcherPath = Path . GetDirectoryName ( launcherFile ) ;
968
+ if ( launcherPath != null )
969
+ {
970
+ Directory . CreateDirectory ( launcherPath ) ;
971
+ }
972
+ await File . WriteAllTextAsync ( desktopFile , contents , token ) ;
973
+ await File . WriteAllTextAsync ( launcherFile , contents , token ) ;
974
+ await Task . Run ( ( ) =>
975
+ {
976
+ var startInfo = new ProcessStartInfo ( "chmod" , $ "+x \" { desktopFile } \" ")
977
+ {
978
+ UseShellExecute = false ,
979
+ WindowStyle = ProcessWindowStyle . Hidden ,
980
+ CreateNoWindow = true
981
+ } ;
982
+ var proc = Process . Start ( startInfo ) ;
983
+ proc ! . WaitForExit ( ) ;
984
+ } , token ) ;
985
+ }
986
+
987
+ CreateLinuxShortcut ( "Choreo (WPILib)" , frcYear , token ) ;
988
+ CreateLinuxShortcut ( "AdvantageScope (WPILib)" , frcYear , token ) ;
989
+ CreateLinuxShortcut ( "Glass" , frcYear , token ) ;
990
+ CreateLinuxShortcut ( "OutlineViewer" , frcYear , token ) ;
991
+ CreateLinuxShortcut ( "DataLogTool" , frcYear , token ) ;
992
+ CreateLinuxShortcut ( "SysId" , frcYear , token ) ;
993
+ CreateLinuxShortcut ( "SmartDashboard" , frcYear , token ) ;
994
+ CreateLinuxShortcut ( "RobotBuilder" , frcYear , token ) ;
995
+ CreateLinuxShortcut ( "PathWeaver" , frcYear , token ) ;
996
+ CreateLinuxShortcut ( "roboRIOTeamNumberSetter" , frcYear , token ) ;
997
+ CreateLinuxShortcut ( "Shuffleboard" , frcYear , token ) ;
937
998
}
938
999
}
939
1000
}
0 commit comments