From 653e7322ee755c92bbd168e2f455d55c1c8a09d9 Mon Sep 17 00:00:00 2001 From: Xiao Pan Date: Sun, 4 May 2025 16:01:53 -0700 Subject: no need sftp_expand_path, current dir is home dir --- remote_plot.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'remote_plot.c') diff --git a/remote_plot.c b/remote_plot.c index b5db6d8..1235218 100644 --- a/remote_plot.c +++ b/remote_plot.c @@ -261,7 +261,6 @@ typedef struct { char *filename; // only read from local .csv file or not bool local; - bool dest_changed; }DATA; static gboolean read_data(gpointer user_data) @@ -324,11 +323,9 @@ static gboolean read_data(gpointer user_data) // This is to represent a loop over time // Let's try a random walk process - // old libssh seems does not have sftp_expand_path - if(data->dest_changed) - file = sftp_open(data->sftp, sftp_expand_path(data->sftp,"~/.local/share/mycan.csv"), access_type, 0); - else - file = sftp_open(data->sftp, "/home/Spartan_Racing_Charger/.local/share/mycan.csv", access_type, 0); + // No need `sftp_expand_path(data->sftp,"~/.local/share/mycan.csv")` because the current dir seems is home dir. + // Also old libssh seems does not have sftp_expand_path + file = sftp_open(data->sftp, ".local/share/mycan.csv", access_type, 0); if (file == NULL) { fprintf(stderr, "Can't open file for reading: %s\n", ssh_get_error(data->session)); @@ -783,7 +780,7 @@ static int command_line (GApplication *app, GApplicationCommandLine *cmdline, gp char *dest="Spartan_Racing_Charger@10.0.0.9"; // https://docs.gtk.org/glib/gvariant-format-strings.html#pointers // &s copy the pointer - data->dest_changed = g_variant_dict_lookup (options, "destination", "&s", &dest); + g_variant_dict_lookup (options, "destination", "&s", &dest); g_variant_dict_lookup (options, "local", "b", &data->local); if(!(data->local)) -- cgit v1.2.3-70-g09d2