From 32e5f4bfe548ebe15c07a4144bc86e09a5305cec Mon Sep 17 00:00:00 2001 From: hwspeedy Date: Wed, 28 Feb 2024 08:05:34 +0100 Subject: FIX sync for newly distributed app to use supplied blobver --- shell/syncmanager.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/shell/syncmanager.c b/shell/syncmanager.c index 72f3255c..436509f4 100644 --- a/shell/syncmanager.c +++ b/shell/syncmanager.c @@ -218,17 +218,23 @@ static void sync_dialog_start_sync(SyncDialog *sd) gint nactions; SyncNetAction *actions; gchar *path; - int fd,len; + int fd=-1,len; gchar buf[101]; path = g_build_filename(g_get_user_config_dir(), "hardinfo2", "blobs-update-version.json", NULL); fd = open(path,O_RDONLY); - if(fd){ + if(fd<0) { + free(path); + path = g_build_filename(params.path_data,"blobs-update-version.json", NULL); + fd = open(path,O_RDONLY); + } + if(fd>=0){ read(fd,buf,100); sscanf(buf,"{\"update-version\":\"%u\",",&our_blobs_update_version); close(fd); } + free(path); DEBUG("OUR2_BLOBS_UPDATE_VERSION=%u",our_blobs_update_version); ensure_soup_session(); @@ -739,16 +745,22 @@ void sync_manager_update_on_startup(void) { GSList *entry; gchar *path; - int fd; + int fd=-1; gchar buf[101]; path = g_build_filename(g_get_user_config_dir(), "hardinfo2", "blobs-update-version.json", NULL); fd = open(path,O_RDONLY); - if(fd){ + if(fd<0) { + free(path); + path = g_build_filename(params.path_data,"blobs-update-version.json", NULL); + fd = open(path,O_RDONLY); + } + if(fd>=0){ read(fd,buf,100); sscanf(buf,"{\"update-version\":\"%u\",",&our_blobs_update_version); close(fd); } + free(path); DEBUG("OUR1_BLOBS_UPDATE_VERSION=%u",our_blobs_update_version); ensure_soup_session(); -- cgit v1.2.3