From 9e739de5d3ab0b1044d333097c3ed5b590cd1b99 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ingo=20B=C3=BCrk?= Date: Sun, 1 Mar 2015 00:13:37 +0100 Subject: [PATCH] Glob filepath when calling append_layout fixes #1500 --- src/commands.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/commands.c b/src/commands.c index 498c25c8..3391fe5b 100644 --- a/src/commands.c +++ b/src/commands.c @@ -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; } -- 2.39.5