x removed several variables from replacement queue because replacing any "1.0" by "U3_ENV_VERSION" doesn't make any sense
! found U3_ENV_SUB_VERSION + added ParseIniFiles-section to parse .ini-files and replace envvars
This commit is contained in:
parent
7d0cd4700f
commit
376dc75b2d
@ -9,6 +9,8 @@ If (StrLen(RunBeforeEject) > 0)
|
||||
StepsAll++
|
||||
If regsvr0 > 0
|
||||
StepsAll++
|
||||
If datini0 > 0
|
||||
StepsAll++
|
||||
If datexe0 > 0
|
||||
StepsAll++
|
||||
If regbak0 > 0
|
||||
@ -154,6 +156,37 @@ Else
|
||||
|
||||
If datexe0 > 0
|
||||
StepsPos++
|
||||
|
||||
;Translate paths in INI files
|
||||
Loop %datini0%
|
||||
{
|
||||
Progress % StepsPos*StepsStep+StepsStep*(A_Index-1)/datini0, Translating paths in file %CurFile% ...
|
||||
CurFile := datini%A_Index%
|
||||
TmpFile := "$$$" . CurFile
|
||||
FileMove %U3_APP_DATA_PATH%\%CurFile%, %U3_APP_DATA_PATH%\%TmpFile%, 1
|
||||
Progress % StepsPos*StepsStep+StepsStep*(A_Index-0.5)/datini0, Translating paths in file %CurFile% ...
|
||||
Loop Read, %U3_APP_DATA_PATH%\%TmpFile%, %U3_APP_DATA_PATH%\%CurFile%
|
||||
{
|
||||
IfNotInString A_LoopReadLine, =
|
||||
{
|
||||
; no key/value-pair --- skip processing
|
||||
FileAppend %A_LoopReadLine%`n
|
||||
Continue
|
||||
}
|
||||
IfNotInString A_LoopReadLine, \
|
||||
{
|
||||
; no paths to replace --- skip processing
|
||||
FileAppend %A_LoopReadLine%`n
|
||||
Continue
|
||||
}
|
||||
SplitFirst(IKey, IVal, A_LoopReadLine, "=")
|
||||
FileAppend % IKey . "=" . EnvUnparseStr(IVal) . "`n"
|
||||
}
|
||||
FileDelete %U3_APP_DATA_PATH%\%TmpFile%
|
||||
}
|
||||
|
||||
If datini0 > 0
|
||||
StepsPos++
|
||||
}
|
||||
|
||||
IniRead KeepSettings, %INIFile%, U3Helper, KeepSettings, 0
|
||||
|
@ -7,6 +7,8 @@
|
||||
StepsAll = 0
|
||||
If regsvr0 > 0
|
||||
StepsAll++
|
||||
If datini0 > 0
|
||||
StepsAll++
|
||||
If datexe0 > 0
|
||||
StepsAll++
|
||||
If regbak0 > 0
|
||||
@ -94,6 +96,36 @@ If (ForeignSettings = "0")
|
||||
StepsPos++
|
||||
}
|
||||
|
||||
;Translate paths in INI files
|
||||
Loop %datini0%
|
||||
{
|
||||
Progress % StepsPos*StepsStep+StepsStep*(A_Index-1)/datini0, Translating paths in file %CurFile% ...
|
||||
CurFile := datini%A_Index%
|
||||
TmpFile := "$$$" . CurFile
|
||||
FileMove %U3_APP_DATA_PATH%\%CurFile%, %U3_APP_DATA_PATH%\%TmpFile%, 1
|
||||
Progress % StepsPos*StepsStep+StepsStep*(A_Index-0.5)/datini0, Translating paths in file %CurFile% ...
|
||||
Loop Read, %U3_APP_DATA_PATH%\%TmpFile%, %U3_APP_DATA_PATH%\%CurFile%
|
||||
{
|
||||
IfNotInString A_LoopReadLine, =
|
||||
{
|
||||
; no key/value-pair --- skip processing
|
||||
FileAppend %A_LoopReadLine%`n
|
||||
Continue
|
||||
}
|
||||
IfNotInString A_LoopReadLine, `%
|
||||
{
|
||||
; no envvars to replace --- skip processing
|
||||
FileAppend %A_LoopReadLine%`n
|
||||
Continue
|
||||
}
|
||||
SplitFirst(IKey, IVal, A_LoopReadLine, "=")
|
||||
FileAppend % IKey . "=" . EnvParseStr(IVal) . "`n"
|
||||
}
|
||||
FileDelete %U3_APP_DATA_PATH%\%TmpFile%
|
||||
}
|
||||
|
||||
If datini0 > 0
|
||||
StepsPos++
|
||||
|
||||
;Copy data files
|
||||
Loop %datexe0%
|
||||
|
@ -3,7 +3,7 @@
|
||||
#Include mb_EnvTools.ahk
|
||||
#Include mb_IniTools.ahk
|
||||
#Include mb_TextTools.ahk
|
||||
U3HVer = 1.7
|
||||
U3HVer = 1.8
|
||||
|
||||
SplitPath A_ScriptFullPath, null, ScrDir, null, ScrFile, ScrDrive
|
||||
INIFile = %ScrDir%\%ScrFile%.ini
|
||||
@ -14,6 +14,7 @@ IniRead RunBeforeStop, %INIFile%, U3Helper, RunBeforeStop, %A_Space%
|
||||
IniRead RunBeforeEject, %INIFile%, U3Helper, RunBeforeEject, %A_Space%
|
||||
IniGetKeys("regsvr", INIFile, "regsvr32")
|
||||
IniGetKeys("datexe", INIFile, "DataToExecDir")
|
||||
IniGetKeys("datini", INIFile, "ParseIniFiles")
|
||||
IniGetKeys("regbak", INIFile, "RegBackup")
|
||||
IniGetKeys("regdel", INIFile, "RegDelete")
|
||||
IniGetKeys("fildel", INIFile, "FileDelete")
|
||||
@ -21,6 +22,8 @@ IniGetKeys("fildel", INIFile, "FileDelete")
|
||||
U3_APP_DATA_PATH := EnvValue("U3_APP_DATA_PATH")
|
||||
U3_HOST_EXEC_PATH := EnvValue("U3_HOST_EXEC_PATH")
|
||||
U3_DEVICE_EXEC_PATH := EnvValue("U3_DEVICE_EXEC_PATH")
|
||||
EnvGet U3_IS_DEVICE_AVAILABLE, U3_IS_DEVICE_AVAILABLE
|
||||
EnvGet U3_IS_AUTORUN, U3_IS_AUTORUN
|
||||
|
||||
WinGetPos,Tx,Ty,Tw,Th,ahk_class Shell_TrayWnd,,,
|
||||
; Tw>Th: horizontal taskbar (top or bottom)
|
||||
|
@ -33,6 +33,12 @@ CCListBar.ocx
|
||||
safe.dat
|
||||
safe.ind
|
||||
|
||||
[ParseIniFiles]
|
||||
; enter filenames of .ini-files to be parsed for env vars on hostConfigure
|
||||
; and re-replace the paths by envvars on hostCleanUp. The files should reside
|
||||
; in %U3_APP_DATA_PATH%
|
||||
test.ini
|
||||
|
||||
[FileDelete]
|
||||
; enter filenames or foldernames to be deleted on eject
|
||||
; Environment variables working (case sensitive!):
|
||||
|
@ -4,10 +4,8 @@ EnvVars0 = 0
|
||||
EnvVals0 = 0
|
||||
|
||||
; initial list of EnvVars to load
|
||||
EnvVarsAll := "U3_DEVICE_SERIAL,U3_DEVICE_PATH,U3_DEVICE_DOCUMENT_PATH,U3_DEVICE_VENDOR,U3_DEVICE_PRODUCT,U3_DEVICE_VENDOR_ID"
|
||||
EnvVarsAll .= ",U3_APP_DATA_PATH,U3_HOST_EXEC_PATH,U3_DEVICE_EXEC_PATH,U3_ENV_VERSION,U3_ENV_LANGUAGE,U3_IS_UPGRADE"
|
||||
EnvVarsAll .= ",U3_IS_DEVICE_AVAILABLE,U3_IS_AUTORUN,U3_DAPI_CONNECT_STRING"
|
||||
EnvVarsAll .= ",ALLUSERSPROFILE,APPDATA,CommonProgramFiles,HOMEPATH,ProgramFiles,SystemRoot,USERPROFILE,TEMP,windir"
|
||||
EnvVarsAll := "U3_DEVICE_PATH,U3_DEVICE_DOCUMENT_PATH,U3_DEVICE_VENDOR,U3_DEVICE_PRODUCT,U3_APP_DATA_PATH,U3_HOST_EXEC_PATH"
|
||||
EnvVarsAll .= ",U3_DEVICE_EXEC_PATH,ALLUSERSPROFILE,APPDATA,CommonProgramFiles,HOMEPATH,ProgramFiles,SystemRoot,USERPROFILE,TEMP,windir"
|
||||
|
||||
StringSplit EnvVarsx, EnvVarsAll, `,%A_Space%
|
||||
|
||||
|
@ -1,24 +1,25 @@
|
||||
EnvAdd("U3_DEVICE_SERIAL") ; serial number of device (copy protection)
|
||||
EnvAdd("U3_DEVICE_PATH") ; drive letter to device (F:)
|
||||
EnvAdd("U3_DEVICE_DOCUMENT_PATH") ; path to documents (F:\Documents)
|
||||
EnvAdd("U3_DEVICE_VENDOR") ; vendor
|
||||
EnvAdd("U3_DEVICE_PRODUCT") ; product name string
|
||||
EnvAdd("U3_DEVICE_VENDOR_ID") ; vendor id (decimal!! 2284 = 0x08ec)
|
||||
EnvAdd("U3_APP_DATA_PATH") ; data path for app (on device)
|
||||
EnvAdd("U3_HOST_EXEC_PATH") ; path to exe on host
|
||||
EnvAdd("U3_DEVICE_EXEC_PATH") ; path to needed files on device
|
||||
EnvAdd("U3_ENV_VERSION") ; should be 1.0
|
||||
EnvAdd("U3_ENV_LANGUAGE") ; language id of LaunchPad
|
||||
EnvAdd("U3_IS_UPGRADE") ; can be "false" or "true"
|
||||
EnvAdd("U3_IS_DEVICE_AVAILABLE") ; "true"/"false"
|
||||
EnvAdd("U3_IS_AUTORUN") ; is this an autorun-launch? "true"/"false"
|
||||
EnvAdd("U3_DAPI_CONNECT_STRING") ; who needs this?
|
||||
EnvAdd("ALLUSERSPROFILE") ; C:\Documents and Settings\All Users
|
||||
EnvAdd("APPDATA") ; C:\Doc...\<username>\Application Data
|
||||
EnvAdd("CommonProgramFiles") ; C:\Program Files\Common Files
|
||||
EnvAdd("HOMEPATH") ; C:\Documents and Settings\<username>
|
||||
EnvAdd("ProgramFiles") ; C:\Program Files
|
||||
EnvAdd("SystemRoot") ; C:\WINDOWS
|
||||
EnvAdd("USERPROFILE") ; C:\Documents and Settings\<username>
|
||||
EnvAdd("TEMP") ; C:\DOCUME~1\<username8.3>\LOCALS~1\Temp
|
||||
EnvAdd("windir") ; C:\WINDOWS
|
||||
U3_DEVICE_SERIAL serial number of device (copy protection, e.g. 0000060415134347)
|
||||
U3_DEVICE_PATH drive letter to device (F:)
|
||||
U3_DEVICE_DOCUMENT_PATH path to documents (F:\Documents)
|
||||
U3_DEVICE_VENDOR vendor
|
||||
U3_DEVICE_PRODUCT product name string
|
||||
U3_DEVICE_VENDOR_ID vendor id (decimal!! 2284 = 0x08ec)
|
||||
U3_APP_DATA_PATH data path for app (on device: X:\System\Apps\{GUID}\Data)
|
||||
U3_HOST_EXEC_PATH path to exe on host (%AppData%\U3\%U3_DEVICE_SERIAL%\{GUID}\Exec)
|
||||
U3_DEVICE_EXEC_PATH path to needed files on device (X:\System\Apps\{GUID}\Exec)
|
||||
U3_ENV_VERSION should be 1.0
|
||||
U3_ENV_SUB_VERSION ??? (currently 2)
|
||||
U3_ENV_LANGUAGE language id of LaunchPad (1033=English, 1031=German, etc.)
|
||||
U3_IS_UPGRADE can be "false" or "true"
|
||||
U3_IS_DEVICE_AVAILABLE "true"/"false"
|
||||
U3_IS_AUTORUN is this an autorun-launch? "true"/"false"
|
||||
U3_DAPI_CONNECT_STRING who needs this? (=U3_DEVICE_SERIAL ???)
|
||||
ALLUSERSPROFILE C:\Documents and Settings\All Users
|
||||
APPDATA C:\Doc...\<username>\Application Data
|
||||
CommonProgramFiles C:\Program Files\Common Files
|
||||
HOMEPATH C:\Documents and Settings\<username>
|
||||
ProgramFiles C:\Program Files
|
||||
SystemRoot C:\WINDOWS
|
||||
USERPROFILE C:\Documents and Settings\<username>
|
||||
TEMP C:\DOCUME~1\<username8.3>\LOCALS~1\Temp
|
||||
windir C:\WINDOWS
|
||||
|
Reference in New Issue
Block a user