From 61831aed166e54fd3c30d94f10705892bc2d8a18 Mon Sep 17 00:00:00 2001 From: mbirth <mbirth> Date: Sun, 29 Apr 2007 14:35:54 +0000 Subject: [PATCH] + added U3Helper-GUID to variable U3HUUID + added example manifest to SVN x also copy empty directories on hostConfigure / hostCleanUp x hostCleanUp fails if device is unplugged (Issue: 2,9) --- U3H_hostCleanUp.ahk | 43 ++++++++++++++++++++++++++++--------------- U3H_hostConfigure.ahk | 31 +++++++++++++++++++++++++------ U3Helper.ahk | 3 ++- manifestex.u3i | 18 ++++++++++++++++++ 4 files changed, 73 insertions(+), 22 deletions(-) create mode 100644 manifestex.u3i diff --git a/U3H_hostCleanUp.ahk b/U3H_hostCleanUp.ahk index 356585e..8182d0a 100644 --- a/U3H_hostCleanUp.ahk +++ b/U3H_hostCleanUp.ahk @@ -100,28 +100,41 @@ Else OutIndex = %A_Index% FileCount = 0 SetWorkingDir %U3_HOST_EXEC_PATH%\%CurFile% - Loop *.*, 0, 1 + Loop *.*, 1, 1 { FileCount++ } - Loop *.*, 0, 1 + Loop *.*, 1, 1 { Progress % StepsPos*StepsStep+StepsStep*(OutIndex-1.00+(A_Index/FileCount))/datexe0, Saving data directory %CurFile% ... (CPY:%Copied% / SKP:%Skipped% / ERR:%Errors%) - FileCopyNewer(A_LoopFileLongPath, U3_APP_DATA_PATH . "\" CurFile . "\" . A_LoopFileFullPath) - If ErrorLevel = 2 - { - CopyErrors .= "Dir-entry: " . CurFile . "\" . A_LoopFileFullPath . " (Error while copying)`n" - Errors++ + FileGetAttrib FAttr, %A_LoopFileLongPath% + IfInString FAttr, D + { + IfNotExist %U3_APP_DATA_PATH%\%CurFile%\%A_LoopFileFullPath% + FileCreateDir %U3_APP_DATA_PATH%\%CurFile%\%A_LoopFileFullPath% + If ErrorLevel + Errors++ + Else + Copied++ } - else if ErrorLevel = 1 - { - CopyErrors .= "Dir-entry: " . CurFile . "\" . A_LoopFileFullPath . " (File does not exist)`n" - Errors++ + Else + { + FileCopyNewer(A_LoopFileLongPath, U3_APP_DATA_PATH . "\" CurFile . "\" . A_LoopFileFullPath) + If ErrorLevel = 2 + { + CopyErrors .= "Dir-entry: " . CurFile . "\" . A_LoopFileFullPath . " (Error while copying)`n" + Errors++ + } + else if ErrorLevel = 1 + { + CopyErrors .= "Dir-entry: " . CurFile . "\" . A_LoopFileFullPath . " (File does not exist)`n" + Errors++ + } + else if ErrorLevel = -1 + Skipped++ + else + Copied++ } - else if ErrorLevel = -1 - Skipped++ - else - Copied++ } SetWorkingDir %A_ScriptDir% } diff --git a/U3H_hostConfigure.ahk b/U3H_hostConfigure.ahk index 2541c58..5d3e73f 100644 --- a/U3H_hostConfigure.ahk +++ b/U3H_hostConfigure.ahk @@ -5,6 +5,8 @@ ; ########################################################################## StepsAll = 0 +IfNotExist %U3_HOST_EXEC_PATH%\%A_ScriptName% + StepsAll++ If regsvr0 > 0 StepsAll++ If datini0 > 0 @@ -21,7 +23,15 @@ StepsPos = 0 Progress b2 x%PL% y%PT% w%PW% m FM%PFM% FS%PFS%, U3Helper %U3HVer% - (c)2006-2007 Markus Birth <mbirth@webwriters.de>, Preparing %AppName% ..., AHKProgress-%AppName% WinSet Transparent, %PTrans%, AHKProgress-%AppName% -Progress, , Checking registry settings... +; made following step not to display b/c it occurs only once on the first launch of any U3H-app +IfNotExist %U3_HOST_EXEC_PATH%\%A_ScriptName% +{ + Progress % StepsPos*StepsStep, Copying U3Helper to disk... + FileCopy %A_ScriptFullPath%, %U3_HOST_EXEC_PATH%\%A_ScriptName%, 0 + StepsPos++ +} + +Progress % StepsPos*StepsStep, Checking registry settings... keycount = 0 ;Registry stuff Loop %regbak0% @@ -143,18 +153,27 @@ Loop %datexe0% OutIndex = %A_Index% FileCount = 0 SetWorkingDir %U3_APP_DATA_PATH%\%CurFile% - Loop *.*, 0, 1 + Loop *.*, 1, 1 { FileCount++ } IfNotExist %U3_HOST_EXEC_PATH%\%CurFile% FileCreateDir %U3_HOST_EXEC_PATH%\%CurFile% - Loop *.*, 0, 1 + Loop *.*, 1, 1 { Progress % StepsPos*StepsStep+StepsStep*(OutIndex-1.00+(A_Index/FileCount))/datexe0, Copying data directory %CurFile% ... (CPY:%Copied% / ERR:%Errors%) - IfNotExist %U3_HOST_EXEC_PATH%\%CurFile%\%A_LoopFileDir% - FileCreateDir %U3_HOST_EXEC_PATH%\%CurFile%\%A_LoopFileDir% - FileCopy %A_LoopFileLongPath%, %U3_HOST_EXEC_PATH%\%CurFile%\%A_LoopFileFullPath%, 1 + FileGetAttrib FAttr, %A_LoopFileLongPath% + IfInString FAttr, D + { + IfNotExist %U3_HOST_EXEC_PATH%\%CurFile%\%A_LoopFileFullPath% + FileCreateDir %U3_HOST_EXEC_PATH%\%CurFile%\%A_LoopFileFullPath% + } + Else + { + IfNotExist %U3_HOST_EXEC_PATH%\%CurFile%\%A_LoopFileDir% + FileCreateDir %U3_HOST_EXEC_PATH%\%CurFile%\%A_LoopFileDir% + FileCopy %A_LoopFileLongPath%, %U3_HOST_EXEC_PATH%\%CurFile%\%A_LoopFileFullPath%, 1 + } If ErrorLevel Errors++ Else diff --git a/U3Helper.ahk b/U3Helper.ahk index 6179282..d8bff55 100644 --- a/U3Helper.ahk +++ b/U3Helper.ahk @@ -3,7 +3,8 @@ #Include mb_EnvTools.ahk #Include mb_IniTools.ahk #Include mb_TextTools.ahk -U3HVer = 2.0 +U3HVer = 2.1 +U3HUUID = 0f90f88c-5e05-4cab-8c3a-e1c0112b06fd U3_APP_DATA_PATH := EnvValue("U3_APP_DATA_PATH") U3_HOST_EXEC_PATH := EnvValue("U3_HOST_EXEC_PATH") diff --git a/manifestex.u3i b/manifestex.u3i new file mode 100644 index 0000000..a5a1583 --- /dev/null +++ b/manifestex.u3i @@ -0,0 +1,18 @@ +<u3manifest version="1.0"> + <application uuid="6873fef3-2000-44ff-81fa-f1a1aa0797a7" version="1.31.0.0325"> + <icon>CCleaner.ico</icon> + <name>CCleaner</name> + <vendor url="http://www.ccleaner.com/">Piriform Ltd.</vendor> + <description>CCleaner is a freeware system optimization and privacy tool. It removes unused files from your system - allowing Windows to run faster and freeing up valuable hard disk space. It also cleans traces of your online activities such as your Internet history.</description> + <options> + <upgrade appData="add" deviceExec="add" /> + <minFreeSpace>2.0</minFreeSpace> + </options> + </application> + <actions> + <hostConfigure cmd="%U3_DEVICE_EXEC_PATH%\..\..\0f90f88c-5e05-4cab-8c3a-e1c0112b06fd\Exec\U3Helper.exe">config</hostConfigure> + <appStart workingdir="%U3_APP_DATA_PATH%" cmd="%U3_HOST_EXEC_PATH%\ccleaner.exe"></appStart> + <appStop cmd="%U3_HOST_EXEC_PATH%\U3Helper.exe">appstop</appStop> + <hostCleanUp cmd="%U3_HOST_EXEC_PATH%\U3Helper.exe">unconfig</hostCleanUp> + </actions> +</u3manifest>