From c4a7f9bb2c805e6b2f2228b3dd4a27c1045926fb Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Sat, 18 Nov 2017 10:01:35 -0600 Subject: [PATCH] Fixed issues #104 and #105 --- GBM/Managers/mgrBackup.vb | 39 ++++++++++++++++++++++++++++----------- GBM/Managers/mgrCommon.vb | 4 ++-- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/GBM/Managers/mgrBackup.vb b/GBM/Managers/mgrBackup.vb index 8b8cbc1..94a1eb5 100644 --- a/GBM/Managers/mgrBackup.vb +++ b/GBM/Managers/mgrBackup.vb @@ -85,14 +85,38 @@ Public Class mgrBackup End Try End Sub + Private Function VerifySavePath(ByVal oGame As clsGame) As String + Dim sSavePath As String + + If oGame.AbsolutePath = False Then + If oGame.Path <> String.Empty Then + sSavePath = oGame.ProcessPath & Path.DirectorySeparatorChar & oGame.Path + Else + sSavePath = oGame.ProcessPath + End If + Else + sSavePath = oGame.Path + End If + + Return sSavePath + End Function + Public Function CheckBackupPrereq(ByVal oGame As clsGame) As Boolean Dim sBackupFile As String = oSettings.BackupFolder - Dim lAvailableSpace As Long = mgrCommon.GetAvailableDiskSpace(sBackupFile) - Dim lFolderSize As Long = mgrCommon.GetFolderSize(oGame.Path, oGame.IncludeArray, oGame.ExcludeArray) + Dim sSavePath As String + Dim lAvailableSpace As Long + Dim lFolderSize As Long If oSettings.CreateSubFolder Then sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.Name sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.Name & ".7z" + 'Verify saved game path + sSavePath = VerifySavePath(oGame) + + 'Calculate space + lAvailableSpace = mgrCommon.GetAvailableDiskSpace(sBackupFile) + lFolderSize = mgrCommon.GetFolderSize(sSavePath, oGame.IncludeArray, oGame.ExcludeArray) + 'Show Available Space RaiseEvent UpdateLog(mgrCommon.FormatString(mgrCommon_AvailableDiskSpace, mgrCommon.FormatDiskSpace(lAvailableSpace)), False, ToolTipIcon.Info, True) @@ -194,15 +218,8 @@ Public Class mgrBackup End If If bDoBackup Then - If oGame.AbsolutePath = False Then - If oGame.Path <> String.Empty Then - sSavePath = oGame.ProcessPath & Path.DirectorySeparatorChar & oGame.Path - Else - sSavePath = oGame.ProcessPath - End If - Else - sSavePath = oGame.Path - End If + + sSavePath = VerifySavePath(oGame) If oGame.FolderSave = True Then BuildFileList(sSavePath, "*", mgrPath.IncludeFileLocation) diff --git a/GBM/Managers/mgrCommon.vb b/GBM/Managers/mgrCommon.vb index 839f170..2339d33 100644 --- a/GBM/Managers/mgrCommon.vb +++ b/GBM/Managers/mgrCommon.vb @@ -283,13 +283,13 @@ Public Class mgrCommon 'Files For Each fi As FileInfo In oFolder.EnumerateFiles() If sInclude.Length > 0 Then - bInclude = CompareValueToArrayRegEx(fi.Name, sInclude) Or CompareValueToArrayRegEx(Path.GetDirectoryName(sPath), sInclude) + bInclude = CompareValueToArrayRegEx(fi.Name, sInclude) Or CompareValueToArrayRegEx(fi.DirectoryName, sInclude) Else bInclude = True End If If sExclude.Length > 0 Then - bExclude = CompareValueToArrayRegEx(fi.Name, sExclude) Or CompareValueToArrayRegEx(Path.GetDirectoryName(sPath), sExclude) + bExclude = CompareValueToArrayRegEx(fi.Name, sExclude) Or CompareValueToArrayRegEx(fi.DirectoryName, sExclude) Else bExclude = False End If