File tree Expand file tree Collapse file tree
YMouseButtonControl.Linux/Services Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- using System . Reflection ;
2- using YMouseButtonControl . Core . Services ;
31using YMouseButtonControl . Core . Services . StartupInstaller ;
42
53namespace YMouseButtonControl . Linux . Services ;
@@ -10,6 +8,7 @@ public class StartupInstallerService : IStartupInstallerService
108 [Desktop Entry]
119 Type=Application
1210 Exec={0}
11+ Path={1}
1312 Hidden=false
1413 NoDisplay=false
1514 X-GNOME-Autostart-enabled=true
@@ -46,15 +45,17 @@ public bool InstallStatus()
4645 return File . ReadAllText ( _desktopFilePath ) . Contains ( expectedExecLine ) ;
4746 }
4847
49- public void Install ( )
50- {
51- File . WriteAllText ( _desktopFilePath , string . Format ( DesktopFile , GetCurExePath ( ) ) ) ;
52- }
48+ public void Install ( ) =>
49+ File . WriteAllText (
50+ _desktopFilePath ,
51+ string . Format ( DesktopFile , GetCurExePath ( ) , GetCurExeParentPath ( ) )
52+ ) ;
5353
54- public void Uninstall ( )
55- {
56- File . Delete ( _desktopFilePath ) ;
57- }
54+ public void Uninstall ( ) => File . Delete ( _desktopFilePath ) ;
55+
56+ private static string GetCurExeParentPath ( ) =>
57+ Path . GetDirectoryName ( GetCurExePath ( ) )
58+ ?? throw new Exception ( "Error retrieving parent of process path" ) ;
5859
5960 private static string GetCurExePath ( ) =>
6061 Environment . ProcessPath ?? throw new Exception ( "Error retrieving process path" ) ;
You can’t perform that action at this time.
0 commit comments