Recent

Author Topic: LazAutoUpdate error  (Read 264 times)

Lainz

  • Hero Member
  • *****
  • Posts: 3097
    • https://lainz.github.io/
LazAutoUpdate error
« on: April 18, 2019, 12:17:39 am »
Hi, I'm having a double path problem (I think) using this component

Quote
[2019-04-17 18:35:12.553 Info] Start of Log
 [2019-04-17 18:35:12.553 Info] updatehm version 0.0.14
 [2019-04-17 18:35:12.553 Info] Given parameters follow:
 [2019-04-17 18:35:12.553 Info] App name = POSBerry.exe
 [2019-04-17 18:35:12.553 Info] Updates folder = C:\Users\Damian\AppData\Local\POSBerry\update
 [2019-04-17 18:35:12.553 Info] WhatsNew filename = whatsnew.txt
 [2019-04-17 18:35:12.553 Info] Pretty Name = POSBerry
 [2019-04-17 18:35:12.553 Info] CopyTree = FALSE
 [2019-04-17 18:35:12.553 Info] Please wait.  Updating POSBerry....
 [2019-04-17 18:35:12.553 Info] Application path = C:\Users\Damian\AppData\Local\POSBerryApp\POSBerry.exe
 [2019-04-17 18:35:12.649 Info] Updated application path = C:\Users\Damian\AppData\Local\POSBerryApp\C:\Users\Damian\AppData\Local\POSBerry\update\POSBerry.exe
 [2019-04-17 18:35:12.649 Info] WhatsNew path = C:\Users\Damian\AppData\Local\POSBerryApp\whatsnew.txt
 [2019-04-17 18:35:12.649 Info] Updated whatsNew path = C:\Users\Damian\AppData\Local\POSBerryApp\C:\Users\Damian\AppData\Local\POSBerry\update\whatsnew.txt
 [2019-04-17 18:35:12.649 Info] Couldn't find szUpdatedEXEPath

The application executable is downloaded, but when updatehm is executed, it can't find the folder "Couldn't find szUpdatedEXEPath".

As I can see in the log the paths are doubled.

The application is in a folder and the updates folder is in another place.

This is the exe location
C:\Users\Damian\AppData\Local\POSBerryApp\POSBerry.exe

And this is the updates location
C:\Users\Damian\AppData\Local\POSBerry\update\POSBerry.exe

Seems that the executable is mixing the two paths in some way...

minesadorada

  • Hero Member
  • *****
  • Posts: 579
  • Retired
Re: LazAutoUpdate error
« Reply #1 on: April 18, 2019, 08:45:20 am »
Hi Lainz,

The Updates folder is passed to updatehm from LazAutoUpdate as the second commandline parameter, (appended to the application folder) and the log is simply displaying that.
It should be set to just a folder name (e.g. updates).  This  folder will always be a subfolder of the application folder and is created by the component on demand.
The reason for this design is that LazAutoUpdate needs to preform file operations (Unzip, copy, delete etc) on the folders so I wanted to avoid hard-to-debug file permission errors that could come from some other arbitary file location used as an updates folder.
In other words, according to design the updates folder has to be a subfolder of the Application folder.Just set it to updates (or icecreamcone or mywhackyname or whatever).
Ideally the documentation should say that, and also the code would include a check and warning etc.
So your solution should be: set the updates property to a simple folder name, not a full path.

Hope this helps.

Frankly, I'm surprised the LazAutoUpdate code still works.  It was written when UTF8 support for file operations was just being incorporated to FPC/Lazarus, and the component is full of file operations.   The codebase needs to be updated to get rid of all the <fileoperation>UTF8 stuff.  Any volunteers?
« Last Edit: April 18, 2019, 09:34:31 am by minesadorada »
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

Lainz

  • Hero Member
  • *****
  • Posts: 3097
    • https://lainz.github.io/
Re: LazAutoUpdate error
« Reply #2 on: April 18, 2019, 04:23:09 pm »
Thanks. Unfortunately the application is installed in older versions in program files and in newer version in a writable folder.

But always the update folder is located in a writable directory.

I will check the source and change it so it can accept the full path.