about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-07-02 10:22:18 +0200
committerMichael Vetter <jubalh@iodoru.org>2020-07-02 10:22:18 +0200
commit1e2a288d80fe0200f1d44d5106f7cc5bfd77718b (patch)
tree47a95c7561f8faba2d02f639e55d1c23d2a54f34 /src/config
parentb45384902dd52850f7691a7480ee3c60fcea4b45 (diff)
downloadprofani-tty-1e2a288d80fe0200f1d44d5106f7cc5bfd77718b.tar.gz
Use correct format when transforming old urlopen.cmd
Additionally to ec7e635e752bdfef851fd177596c1d73d97afb42.

In the earlier commit I just setted the test value ignoring the real
format.

Now we correctly transform:

```
[logging]
urlopen.cmd=xdg-open
```

into:

```
[executables]
url.open.cmd=false;xdg-open %u;
```
Diffstat (limited to 'src/config')
-rw-r--r--src/config/preferences.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/config/preferences.c b/src/config/preferences.c
index 088e91f8..fa81b353 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -163,9 +163,16 @@ static void _prefs_load(void)
 
     // 0.9.0 introduced /urlopen. It was saved under "logging" section. Now we have a new "executables" section.
     if (g_key_file_has_key(prefs, PREF_GROUP_LOGGING, "urlopen.cmd", NULL)) {
-        char *value = g_key_file_get_string(prefs, PREF_GROUP_LOGGING, "urlopen.cmd", NULL);
-        g_key_file_set_string(prefs, PREF_GROUP_EXECUTABLES, "url.open.cmd", value);
+        char *val = g_key_file_get_string(prefs, PREF_GROUP_LOGGING, "urlopen.cmd", NULL);
+
+        GString *value = g_string_new("false;");
+        value = g_string_append(value, val);
+        value = g_string_append(value, " %u;");
+
+        g_key_file_set_string(prefs, PREF_GROUP_EXECUTABLES, "url.open.cmd", value->str);
         g_key_file_remove_key(prefs, PREF_GROUP_LOGGING, "urlopen.cmd", NULL);
+
+        g_string_free(value, TRUE);
     }
 
     // 0.9.0 introduced configurable /avatar. It was saved under "logging" section. Now we have a new "executables" section.