]> git.sur5r.net Git - i3/i3/commitdiff
Glob filepath when calling append_layout 1503/head
authorIngo Bürk <ingo.buerk@tngtech.com>
Sat, 28 Feb 2015 23:13:37 +0000 (00:13 +0100)
committerIngo Bürk <ingo.buerk@tngtech.com>
Sun, 1 Mar 2015 15:51:58 +0000 (16:51 +0100)
fixes #1500

src/commands.c

index 498c25c85b7aa5a33578219bf637e30cd8c877c8..3391fe5bdd16b074e752dbaa929627904d650da7 100644 (file)
@@ -900,11 +900,15 @@ void cmd_nop(I3_CMD, char *comment) {
 void cmd_append_layout(I3_CMD, char *path) {
     LOG("Appending layout \"%s\"\n", path);
 
+    /* Make sure we allow paths like '~/.i3/layout.json' */
+    path = resolve_tilde(path);
+
     json_content_t content = json_determine_content(path);
     LOG("JSON content = %d\n", content);
     if (content == JSON_CONTENT_UNKNOWN) {
         ELOG("Could not determine the contents of \"%s\", not loading.\n", path);
         ysuccess(false);
+        free(path);
         return;
     }
 
@@ -946,6 +950,7 @@ void cmd_append_layout(I3_CMD, char *path) {
     if (content == JSON_CONTENT_WORKSPACE)
         ipc_send_workspace_event("restored", parent, NULL);
 
+    free(path);
     cmd_output->needs_tree_render = true;
 }