Fixed some autostart issues #178
This commit is contained in:
+38
-18
@@ -1186,8 +1186,9 @@ Public Class frmMain
|
|||||||
'Verify the "Start with Windows" setting
|
'Verify the "Start with Windows" setting
|
||||||
If oSettings.StartWithWindows Then
|
If oSettings.StartWithWindows Then
|
||||||
If mgrCommon.IsUnix Then
|
If mgrCommon.IsUnix Then
|
||||||
If Not VerifyAutoStartLinux() Then
|
Dim sVerifyError As String = String.Empty
|
||||||
UpdateLog(frmMain_ErrorLinuxAutoStartMissing, False, ToolTipIcon.Info)
|
If Not VerifyAutoStartLinux(sVerifyError) Then
|
||||||
|
UpdateLog(sVerifyError, False, ToolTipIcon.Info)
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
If Not VerifyStartWithWindows() Then
|
If Not VerifyStartWithWindows() Then
|
||||||
@@ -1746,29 +1747,48 @@ Public Class frmMain
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Function VerifyAutoStartLinux() As Boolean
|
Private Function VerifyAutoStartLinux(ByRef sErrorMessage As String) As Boolean
|
||||||
Dim oProcess As Process
|
Dim oProcess As Process
|
||||||
Dim sAutoStartFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) & Path.DirectorySeparatorChar & ".config/autostart/"
|
Dim sAutoStartFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) & Path.DirectorySeparatorChar & ".config/autostart/"
|
||||||
|
|
||||||
If File.Exists(sAutoStartFolder & Path.DirectorySeparatorChar & "gbm.desktop") Then
|
'Check if the app is still properly installed
|
||||||
Return True
|
If File.Exists("/usr/share/applications/gbm.desktop") Then
|
||||||
Else
|
If File.Exists(sAutoStartFolder & Path.DirectorySeparatorChar & "gbm.desktop") Then
|
||||||
'Create the autostart folder if it doesn't exist yet
|
Return True
|
||||||
If Not Directory.Exists(sAutoStartFolder) Then
|
Else
|
||||||
Directory.CreateDirectory(sAutoStartFolder)
|
'Create the autostart folder if it doesn't exist yet
|
||||||
|
If Not Directory.Exists(sAutoStartFolder) Then
|
||||||
|
Directory.CreateDirectory(sAutoStartFolder)
|
||||||
|
End If
|
||||||
|
'Create link
|
||||||
|
Try
|
||||||
|
oProcess = New Process
|
||||||
|
oProcess.StartInfo.FileName = "/bin/ln"
|
||||||
|
oProcess.StartInfo.Arguments = "-s /usr/share/applications/gbm.desktop " & sAutoStartFolder
|
||||||
|
oProcess.StartInfo.UseShellExecute = False
|
||||||
|
oProcess.StartInfo.RedirectStandardOutput = True
|
||||||
|
oProcess.StartInfo.CreateNoWindow = True
|
||||||
|
oProcess.Start()
|
||||||
|
Catch ex As Exception
|
||||||
|
mgrCommon.ShowMessage(frmSettings_ErrorLinuxAutoStart, ex.Message, MsgBoxStyle.Exclamation)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
sErrorMessage = frmMain_ErrorLinuxAutoStartMissing
|
||||||
|
Return False
|
||||||
End If
|
End If
|
||||||
'Create link
|
Else
|
||||||
|
'If the app is no longer properly installed, disable autostart and the setting.
|
||||||
Try
|
Try
|
||||||
oProcess = New Process
|
oSettings.StartWithWindows = False
|
||||||
oProcess.StartInfo.FileName = "/bin/ln"
|
oSettings.SaveSettings()
|
||||||
oProcess.StartInfo.Arguments = "-s /usr/share/applications/gbm.desktop " & sAutoStartFolder
|
If File.Exists(sAutoStartFolder & Path.DirectorySeparatorChar & "gbm.desktop") Then
|
||||||
oProcess.StartInfo.UseShellExecute = False
|
File.Delete(sAutoStartFolder & Path.DirectorySeparatorChar & "gbm.desktop")
|
||||||
oProcess.StartInfo.RedirectStandardOutput = True
|
End If
|
||||||
oProcess.StartInfo.CreateNoWindow = True
|
|
||||||
oProcess.Start()
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
mgrCommon.ShowMessage(frmSettings_ErrorLinuxAutoStart, ex.Message, MsgBoxStyle.Exclamation)
|
mgrCommon.ShowMessage(frmSettings_ErrorLinuxAutoStart, ex.Message, MsgBoxStyle.Exclamation)
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
|
sErrorMessage = frmMain_ErrorLinuxAutoStartLinkMissing
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
End Function
|
End Function
|
||||||
@@ -2182,7 +2202,7 @@ Public Class frmMain
|
|||||||
tmMinimizeTimer.Start()
|
tmMinimizeTimer.Start()
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
Me.gMonTray.Visible = True
|
Me.gMonTray.Visible = True
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
|||||||
@@ -357,9 +357,8 @@ Public Class frmSettings
|
|||||||
chkDisableDiskSpaceCheck.Text = frmSettings_chkDisableDiskSpaceCheck
|
chkDisableDiskSpaceCheck.Text = frmSettings_chkDisableDiskSpaceCheck
|
||||||
|
|
||||||
If mgrCommon.IsUnix Then
|
If mgrCommon.IsUnix Then
|
||||||
'Only enable these options on Linux if GBM was installed with an official method
|
'Only enable this option on Linux if GBM was installed with an official method
|
||||||
If Not File.Exists("/usr/share/applications/gbm.desktop") Then
|
If Not File.Exists("/usr/share/applications/gbm.desktop") Then
|
||||||
chkStartMinimized.Enabled = False
|
|
||||||
chkAutoStart.Enabled = False
|
chkAutoStart.Enabled = False
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|||||||
Generated
+10
-1
@@ -3309,6 +3309,15 @@ Namespace My.Resources
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Looks up a localized string similar to GBM is set to start automatically, but the desktop link is missing. Automatic start has been disabled, please re-install GBM using a package manager..
|
||||||
|
'''</summary>
|
||||||
|
Friend ReadOnly Property frmMain_ErrorLinuxAutoStartLinkMissing() As String
|
||||||
|
Get
|
||||||
|
Return ResourceManager.GetString("frmMain_ErrorLinuxAutoStartLinkMissing", resourceCulture)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
'''<summary>
|
'''<summary>
|
||||||
''' Looks up a localized string similar to GBM is set to start automatically, but the autostart link is missing. The autostart link has been re-created..
|
''' Looks up a localized string similar to GBM is set to start automatically, but the autostart link is missing. The autostart link has been re-created..
|
||||||
'''</summary>
|
'''</summary>
|
||||||
@@ -4867,7 +4876,7 @@ Namespace My.Resources
|
|||||||
End Property
|
End Property
|
||||||
|
|
||||||
'''<summary>
|
'''<summary>
|
||||||
''' Looks up a localized string similar to An error occured while creating the autostart link:[BR][BR][PARAM].
|
''' Looks up a localized string similar to An error occured while configuring autostart:[BR][BR][PARAM].
|
||||||
'''</summary>
|
'''</summary>
|
||||||
Friend ReadOnly Property frmSettings_ErrorLinuxAutoStart() As String
|
Friend ReadOnly Property frmSettings_ErrorLinuxAutoStart() As String
|
||||||
Get
|
Get
|
||||||
|
|||||||
@@ -2345,7 +2345,7 @@
|
|||||||
<value>GBM is set to start automatically, but the autostart link is missing. The autostart link has been re-created.</value>
|
<value>GBM is set to start automatically, but the autostart link is missing. The autostart link has been re-created.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="frmSettings_ErrorLinuxAutoStart" xml:space="preserve">
|
<data name="frmSettings_ErrorLinuxAutoStart" xml:space="preserve">
|
||||||
<value>An error occured while creating the autostart link:[BR][BR][PARAM]</value>
|
<value>An error occured while configuring autostart:[BR][BR][PARAM]</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="mgrBackup_ErrorRegBackupElevation" xml:space="preserve">
|
<data name="mgrBackup_ErrorRegBackupElevation" xml:space="preserve">
|
||||||
<value>[PARAM] stores saved games in the Windows registry, accessing the registry requires elevated permissions. Please restart GBM as Administrator to perform this backup.</value>
|
<value>[PARAM] stores saved games in the Windows registry, accessing the registry requires elevated permissions. Please restart GBM as Administrator to perform this backup.</value>
|
||||||
@@ -2368,4 +2368,7 @@
|
|||||||
<data name="mgrRestore_ErrorRegBackupElevation" xml:space="preserve">
|
<data name="mgrRestore_ErrorRegBackupElevation" xml:space="preserve">
|
||||||
<value>[PARAM] stores saved games in the Windows registry, accessing the registry requires elevated permissions. Please restart GBM as Administrator to restore this backup.</value>
|
<value>[PARAM] stores saved games in the Windows registry, accessing the registry requires elevated permissions. Please restart GBM as Administrator to restore this backup.</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="frmMain_ErrorLinuxAutoStartLinkMissing" xml:space="preserve">
|
||||||
|
<value>GBM is set to start automatically, but the desktop link is missing. Automatic start has been disabled, please re-install GBM using a package manager.</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
Reference in New Issue
Block a user