From 9fc53e74b1987fa9d719852d6fb368a0c0a3f5c8 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Sat, 8 Sep 2018 09:35:46 -0600 Subject: [PATCH] Use linux variables in db upgrade for issue #152 --- GBM/Managers/mgrSQLite.vb | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/GBM/Managers/mgrSQLite.vb b/GBM/Managers/mgrSQLite.vb index 0431200..65db77a 100644 --- a/GBM/Managers/mgrSQLite.vb +++ b/GBM/Managers/mgrSQLite.vb @@ -863,12 +863,18 @@ Public Class mgrSQLite 'Backup DB before starting BackupDB("v110") - 'Convert core path variables to new standard - sSQL = "UPDATE monitorlist SET Path = Replace(Path,'*appdatalocal*','%LOCALAPPDATA%');" - sSQL &= "UPDATE monitorlist SET Path = Replace(Path,'*appdataroaming*','%APPDATA%');" - sSQL &= "UPDATE monitorlist SET Path = Replace(Path,'*mydocs*','%USERDOCUMENTS%');" - sSQL &= "UPDATE monitorlist SET Path = Replace(Path,'*currentuser*','%USERPROFILE%');" - sSQL &= "UPDATE monitorlist SET Path = Replace(Path,'*publicdocs*','%COMMONDOCUMENTS%');" + 'Convert core path variables to new standard + If Not mgrCommon.IsUnix Then + sSQL = "UPDATE monitorlist SET Path = Replace(Path,'*appdatalocal*','%LOCALAPPDATA%');" + sSQL &= "UPDATE monitorlist SET Path = Replace(Path,'*appdataroaming*','%APPDATA%');" + sSQL &= "UPDATE monitorlist SET Path = Replace(Path,'*mydocs*','%USERDOCUMENTS%');" + sSQL &= "UPDATE monitorlist SET Path = Replace(Path,'*currentuser*','%USERPROFILE%');" + sSQL &= "UPDATE monitorlist SET Path = Replace(Path,'*publicdocs*','%COMMONDOCUMENTS%');" + Else + sSQL = "UPDATE monitorlist SET Path = Replace(Path,'*appdatalocal*','${XDG_DATA_HOME:-~/.local/share}');" + sSQL &= "UPDATE monitorlist SET Path = Replace(Path,'*appdataroaming*','${XDG_CONFIG_HOME:-~/.config}');" + sSQL &= "UPDATE monitorlist SET Path = Replace(Path,'*mydocs*','~');" + End If 'Convert custom variables to new standard Dim hshVariables As Hashtable = mgrVariables.ReadVariables() @@ -880,9 +886,9 @@ Public Class mgrSQLite sSQL &= "PRAGMA user_version=115" - RunParamQuery(sSQL, New Hashtable) + RunParamQuery(sSQL, New Hashtable) + End If End If - End If End Sub Public Function GetDBSize() As Long