No, no idea.
I worked it out. It was a date format issue and region settings that cause the date set in the Windows shell script to come out weird and include a "/" also. I've changed the script to use this code instead:
@SETLOCAL ENABLEDELAYEDEXPANSION @REM Use WMIC to retrieve date and time FOR /F "skip=1 tokens=1-6" %%A IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') DO ( IF NOT "%%~F"=="" ( SET /A SortDate = 10000 * %%F + 100 * %%D + %%A set YEAR=!SortDate:~0,4! set MON=!SortDate:~4,2! set DAY=!SortDate:~6,2! @REM Add 1000000 so as to force a prepended 0 if hours less than 10 SET /A SortTime = 1000000 + 10000 * %%B + 100 * %%C + %%E set HOUR=!SortTime:~1,2! set MIN=!SortTime:~3,2! set SEC=!SortTime:~5,2! ) ) REM ----------------- SET TODAY_DATE=%YEAR%-%MON%-%DAY% %HOUR%:%MIN%:%SEC% SET DATE_CODE=%YEAR%%MON%%DAY%%HOUR%%MIN%%SEC% SET APP_PATH=%APP_PARENT%\%APP_NAME% SET BACKUP_PARENT=%APP_PATH%-%DATE_CODE%
Log looks like: "STARTED ON 2017-02-17 12:39:33"
Backup folder name looks like: "KajuUpdater.exe-20170217123933"
Really sorry but I've modified your code a lot to fit in with my app so the changes I've made are not in your project.
I'm also not using source control and use subversion not git for my projects.
You can just copy the shell code above manually when you get the chance. You'll be able to see easily where it slots into the existing code. :)
I would also suggest adding the option to quit and relaunch as admin (see link below) if the updater encounters a write permission error which I have found if the app is located within Windows "Program Files" folder:
When the write permission is denied I now give the user the option to relaunch as admin, go to web updates page or cancel.
It works quite well, you just have to call the ExecuteWithUAC() method on App.CancelClose event and intercept the command line parameter on App.Open event to automatically re-check for updates again so the user can pick up where they left off before the write permission error occurred.
Sure, it's just the easiest way I've found to get around the Windows write permission issue that only ever happens for me when trying to auto-update the app within the Program Files folder.
I'm yet to try Kaju on the Mac so will report back my findingss when I do.
Thanks again for such a great utility!
Sure, that would be great. I only build for Windows and Mac so it would work for me but obviously it would be good for Linux developers to have a solution too. I really have no idea about Linux at all though so I'm afraid I can't offer any ideas on that front.
One thing I did note about that example is that you need to add Chr(34) around f.NativePath since the script failed during testing on a test user account that by default did not have admin rights:
sh.Execute("Wscript.exe " + Chr(34) + f.NativePath + Chr(34) )
Don't do a version with the number 4.0.4.
I wanted to check why I get "an error occurred" when loading an update after updating from 4.0.3 to 4.0.4. I changed the version information to an older version and did some debugging. When coming to the code
dim raw as string = http.Get( url, 10 ) if http.HTTPStatusCode = 404 or instr(raw, "404") > 0 then // Not found mResult = ResultType.NoUpdateAvailable exit do elseif raw = "" then if HandleError( KajuLocale.kErrorNoUpdateData ) then continue do else exit do end if end if
it looked at first glance like the socket had problems with getting the update data. Instead I have a download url
This is the original code:
dim raw as string = http.Get( url, 5 ) if http.HTTPStatusCode = 404 then // Not found mResult = ResultType.NoUpdateAvailable exit do elseif raw = "" then if HandleError( KajuLocale.kErrorNoUpdateData ) then continue do else exit do end if end if
@Beatrix W Hmm.. as the senior moments are getting worse and worse: I seem to remember that the socket didn't give the proper status code. Therefore, I added the code to shoot myself into the foot.
Perhaps you might want to search for "file not found" in the response text instead of "404"
It's not exactly a good workaround for the socket not having the right response code, but it's less likely to result in a false positive match.