Resolved #151 - Pass 2: Cleaned up

This commit is contained in:
Michael J. Seiferling
2019-03-10 11:45:36 -06:00
parent 80172aaa31
commit f5626a2613
6 changed files with 23 additions and 17 deletions
+6
View File
@@ -1396,6 +1396,12 @@ Public Class frmGameManager
oApp.Parameter = txtParameter.Text oApp.Parameter = txtParameter.Text
oApp.OS = CType(cboOS.SelectedValue, clsGame.eOS) oApp.OS = CType(cboOS.SelectedValue, clsGame.eOS)
oApp.Path = mgrPath.ValidatePathForOS(txtSavePath.Text) oApp.Path = mgrPath.ValidatePathForOS(txtSavePath.Text)
'If we have a registry path, trim any trailing backslashes because they cause export failures
If mgrPath.IsSupportedRegistryPath(oApp.Path) Then
oApp.Path = oApp.Path.TrimEnd("\")
End If
'We need to handle a special case here when working with Windows configurations in Linux 'We need to handle a special case here when working with Windows configurations in Linux
If mgrCommon.IsUnix And mgrVariables.CheckForReservedVariables(oApp.Path) And oApp.OS = clsGame.eOS.Windows Then If mgrCommon.IsUnix And mgrVariables.CheckForReservedVariables(oApp.Path) And oApp.OS = clsGame.eOS.Windows Then
oApp.AbsolutePath = True oApp.AbsolutePath = True
+6 -6
View File
@@ -127,7 +127,7 @@ Public Class mgrBackup
bRegistry = mgrPath.IsSupportedRegistryPath(oGame.TruePath) bRegistry = mgrPath.IsSupportedRegistryPath(oGame.TruePath)
If bRegistry Then If bRegistry Then
'If this is a registry backup, we need to have elevated permissions in Windows to use regedit 'If this is a registry backup, we need to have elevated permissions in Windows to use reg.exe
If Not mgrCommon.IsUnix And Not mgrCommon.IsElevated Then If Not mgrCommon.IsUnix And Not mgrCommon.IsElevated Then
RaiseEvent UpdateLog(mgrCommon.FormatString(mgrBackup_ErrorRegBackupElevation, oGame.Name), False, ToolTipIcon.Info, True) RaiseEvent UpdateLog(mgrCommon.FormatString(mgrBackup_ErrorRegBackupElevation, oGame.Name), False, ToolTipIcon.Info, True)
Return False Return False
@@ -314,7 +314,7 @@ Public Class mgrBackup
Dim sBinaryPath As String Dim sBinaryPath As String
Dim sArguments As String Dim sArguments As String
Dim oWineData As clsWineData Dim oWineData As clsWineData
Dim sWineRegEdit As String Dim sWineReg As String
Dim bPathVerified As Boolean = False Dim bPathVerified As Boolean = False
Dim bBackupCompleted As Boolean = False Dim bBackupCompleted As Boolean = False
@@ -324,13 +324,13 @@ Public Class mgrBackup
oWineData = mgrWineData.DoWineDataGetbyID(oGame.ID) oWineData = mgrWineData.DoWineDataGetbyID(oGame.ID)
prsReg.StartInfo.EnvironmentVariables.Add("WINEPREFIX", oWineData.Prefix) prsReg.StartInfo.EnvironmentVariables.Add("WINEPREFIX", oWineData.Prefix)
sBinaryPath = oWineData.BinaryPath & Path.DirectorySeparatorChar & "wine" sBinaryPath = oWineData.BinaryPath & Path.DirectorySeparatorChar & "wine"
sWineRegEdit = oWineData.Prefix & Path.DirectorySeparatorChar & "drive_c/windows/system32/reg.exe" sWineReg = oWineData.Prefix & Path.DirectorySeparatorChar & "drive_c/windows/system32/reg.exe"
sArguments = """" & sWineRegEdit & """ " & sArguments sArguments = """" & sWineReg & """ " & sArguments
If File.Exists(sBinaryPath) Then If File.Exists(sBinaryPath) Then
If File.Exists(sWineRegEdit) Then If File.Exists(sWineReg) Then
bPathVerified = True bPathVerified = True
Else Else
RaiseEvent UpdateLog(mgrCommon.FormatString(mgrBackup_ErrorRegNotFound, sWineRegEdit), False, ToolTipIcon.Error, True) RaiseEvent UpdateLog(mgrCommon.FormatString(mgrBackup_ErrorRegNotFound, sWineReg), False, ToolTipIcon.Error, True)
End If End If
Else Else
RaiseEvent UpdateLog(mgrCommon.FormatString(mgrBackup_ErrorWineNotFound, sBinaryPath), False, ToolTipIcon.Error, True) RaiseEvent UpdateLog(mgrCommon.FormatString(mgrBackup_ErrorWineNotFound, sBinaryPath), False, ToolTipIcon.Error, True)
+1 -1
View File
@@ -485,7 +485,7 @@ Public Class mgrPath
Return sValue Return sValue
End Function End Function
Public Shared Function IsSupportedRegistryPath(ByVal sPath As String) Public Shared Function IsSupportedRegistryPath(ByVal sPath As String) As Boolean
If sPath.StartsWith("HKEY_CURRENT_USER") Then If sPath.StartsWith("HKEY_CURRENT_USER") Then
Return True Return True
ElseIf sPath.StartsWith("HKEY_LOCAL_MACHINE") Then ElseIf sPath.StartsWith("HKEY_LOCAL_MACHINE") Then
+6 -6
View File
@@ -129,7 +129,7 @@ Public Class mgrRestore
bRegistry = mgrPath.IsSupportedRegistryPath(oBackupInfo.TruePath) bRegistry = mgrPath.IsSupportedRegistryPath(oBackupInfo.TruePath)
If bRegistry Then If bRegistry Then
'If this is a registry backup, we need to have elevated permissions in Windows to use regedit 'If this is a registry backup, we need to have elevated permissions in Windows to use reg.exe
If Not mgrCommon.IsUnix And Not mgrCommon.IsElevated Then If Not mgrCommon.IsUnix And Not mgrCommon.IsElevated Then
RaiseEvent UpdateLog(mgrCommon.FormatString(mgrRestore_ErrorRegBackupElevation, oBackupInfo.Name), False, ToolTipIcon.Info, True) RaiseEvent UpdateLog(mgrCommon.FormatString(mgrRestore_ErrorRegBackupElevation, oBackupInfo.Name), False, ToolTipIcon.Info, True)
Return False Return False
@@ -187,7 +187,7 @@ Public Class mgrRestore
Dim sBinaryPath As String Dim sBinaryPath As String
Dim sArguments As String Dim sArguments As String
Dim oWineData As clsWineData Dim oWineData As clsWineData
Dim sWineRegEdit As String Dim sWineReg As String
Dim bPathVerified As Boolean Dim bPathVerified As Boolean
Dim bRestoreCompleted As Boolean = False Dim bRestoreCompleted As Boolean = False
@@ -197,13 +197,13 @@ Public Class mgrRestore
oWineData = mgrWineData.DoWineDataGetbyID(oBackupInfo.MonitorID) oWineData = mgrWineData.DoWineDataGetbyID(oBackupInfo.MonitorID)
prsReg.StartInfo.EnvironmentVariables.Add("WINEPREFIX", oWineData.Prefix) prsReg.StartInfo.EnvironmentVariables.Add("WINEPREFIX", oWineData.Prefix)
sBinaryPath = oWineData.BinaryPath & Path.DirectorySeparatorChar & "wine" sBinaryPath = oWineData.BinaryPath & Path.DirectorySeparatorChar & "wine"
sWineRegEdit = oWineData.Prefix & Path.DirectorySeparatorChar & "drive_c/windows/system32/reg.exe" sWineReg = oWineData.Prefix & Path.DirectorySeparatorChar & "drive_c/windows/system32/reg.exe"
sArguments = """" & sWineRegEdit & """ " & sArguments sArguments = """" & sWineReg & """ " & sArguments
If File.Exists(sBinaryPath) Then If File.Exists(sBinaryPath) Then
If File.Exists(sWineRegEdit) Then If File.Exists(sWineReg) Then
bPathVerified = True bPathVerified = True
Else Else
RaiseEvent UpdateLog(mgrCommon.FormatString(mgrRestore_ErrorRegNotFound, sWineRegEdit), False, ToolTipIcon.Error, True) RaiseEvent UpdateLog(mgrCommon.FormatString(mgrRestore_ErrorRegNotFound, sWineReg), False, ToolTipIcon.Error, True)
End If End If
Else Else
RaiseEvent UpdateLog(mgrCommon.FormatString(mgrRestore_ErrorWineNotFound, sBinaryPath), False, ToolTipIcon.Error, True) RaiseEvent UpdateLog(mgrCommon.FormatString(mgrRestore_ErrorWineNotFound, sBinaryPath), False, ToolTipIcon.Error, True)
+2 -2
View File
@@ -6151,7 +6151,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to The regedit utility could not be located at [PARAM]. The backup cannot continue.. ''' Looks up a localized string similar to The utility reg.exe could not be located at [PARAM]. The backup cannot continue..
'''</summary> '''</summary>
Friend ReadOnly Property mgrBackup_ErrorRegNotFound() As String Friend ReadOnly Property mgrBackup_ErrorRegNotFound() As String
Get Get
@@ -6700,7 +6700,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to The regedit utility could not be located at [PARAM]. The restore cannot continue.. ''' Looks up a localized string similar to The utility reg.exe could not be located at [PARAM]. The restore cannot continue..
'''</summary> '''</summary>
Friend ReadOnly Property mgrRestore_ErrorRegNotFound() As String Friend ReadOnly Property mgrRestore_ErrorRegNotFound() As String
Get Get
+2 -2
View File
@@ -2354,13 +2354,13 @@
<value>The backup has failed, please ensure the registry path is correct.</value> <value>The backup has failed, please ensure the registry path is correct.</value>
</data> </data>
<data name="mgrBackup_ErrorRegNotFound" xml:space="preserve"> <data name="mgrBackup_ErrorRegNotFound" xml:space="preserve">
<value>The regedit utility could not be located at [PARAM]. The backup cannot continue.</value> <value>The utility reg.exe could not be located at [PARAM]. The backup cannot continue.</value>
</data> </data>
<data name="mgrBackup_ErrorWineNotFound" xml:space="preserve"> <data name="mgrBackup_ErrorWineNotFound" xml:space="preserve">
<value>The wine binary could not be located at [PARAM]. The backup cannot continue.</value> <value>The wine binary could not be located at [PARAM]. The backup cannot continue.</value>
</data> </data>
<data name="mgrRestore_ErrorRegNotFound" xml:space="preserve"> <data name="mgrRestore_ErrorRegNotFound" xml:space="preserve">
<value>The regedit utility could not be located at [PARAM]. The restore cannot continue.</value> <value>The utility reg.exe could not be located at [PARAM]. The restore cannot continue.</value>
</data> </data>
<data name="mgrRestore_ErrorWineNotFound" xml:space="preserve"> <data name="mgrRestore_ErrorWineNotFound" xml:space="preserve">
<value>The wine binary could not be located at [PARAM]. The restore cannot continue.</value> <value>The wine binary could not be located at [PARAM]. The restore cannot continue.</value>