all: sync with master

This commit is contained in:
Ainar Garipov
2022-09-07 18:03:18 +03:00
parent d23da1b757
commit faf2b32389
108 changed files with 2925 additions and 2390 deletions

View File

@@ -117,7 +117,7 @@ func (u *Updater) Update() (err error) {
return err
}
err = u.prepare(filepath.Base(execPath))
err = u.prepare(execPath)
if err != nil {
return err
}
@@ -169,7 +169,7 @@ func (u *Updater) VersionCheckURL() (vcu string) {
}
// prepare fills all necessary fields in Updater object.
func (u *Updater) prepare(exeName string) (err error) {
func (u *Updater) prepare(exePath string) (err error) {
u.updateDir = filepath.Join(u.workDir, fmt.Sprintf("agh-update-%s", u.newVersion))
_, pkgNameOnly := filepath.Split(u.packageURL)
@@ -185,7 +185,7 @@ func (u *Updater) prepare(exeName string) (err error) {
updateExeName = "AdGuardHome.exe"
}
u.backupExeName = filepath.Join(u.backupDir, exeName)
u.backupExeName = filepath.Join(u.backupDir, filepath.Base(exePath))
u.updateExeName = filepath.Join(u.updateDir, updateExeName)
log.Debug(
@@ -195,7 +195,7 @@ func (u *Updater) prepare(exeName string) (err error) {
u.packageURL,
)
u.currentExeName = filepath.Join(u.workDir, exeName)
u.currentExeName = exePath
_, err = os.Stat(u.currentExeName)
if err != nil {
return fmt.Errorf("checking %q: %w", u.currentExeName, err)