Skip to content

Commit

Permalink
Put updates for AppImages in right directory (fixes #37)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAssassin committed Nov 15, 2017
1 parent 2ce9497 commit 8199a82
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <fnmatch.h>
#include <fstream>
#include <iostream>
#include <libgen.h>
#include <mutex>
#include <sstream>
#include <thread>
Expand Down Expand Up @@ -402,6 +403,14 @@ namespace appimage {
appImage->updateInformationType == ZSYNC_GENERIC) {
// doesn't matter which type it is exactly, they all work like the same
zSyncClient = new zsync2::ZSyncClient(appImage->zsyncUrl, pathToAppImage, overwrite);

// make sure the new AppImage goes into the same directory as the old one
// unfortunately, to be able to use dirname(), one has to copy the C string first
auto* path = strdup(appImage->filename.c_str());
std::string dirPath = dirname(path);
free(path);

zSyncClient->setCwd(dirPath);
} else {
// error unsupported type
state = ERROR;
Expand Down

0 comments on commit 8199a82

Please sign in to comment.