Merge pull request #1503 from Airblader/defect-layout-globbing

Glob filepath when calling append_layout
This commit is contained in:
Michael Stapelberg 2015-03-01 08:25:09 -08:00
commit 487ccb536a
1 changed files with 5 additions and 0 deletions

View File

@ -900,11 +900,15 @@ void cmd_nop(I3_CMD, char *comment) {
void cmd_append_layout(I3_CMD, char *path) { void cmd_append_layout(I3_CMD, char *path) {
LOG("Appending layout \"%s\"\n", 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); json_content_t content = json_determine_content(path);
LOG("JSON content = %d\n", content); LOG("JSON content = %d\n", content);
if (content == JSON_CONTENT_UNKNOWN) { if (content == JSON_CONTENT_UNKNOWN) {
ELOG("Could not determine the contents of \"%s\", not loading.\n", path); ELOG("Could not determine the contents of \"%s\", not loading.\n", path);
ysuccess(false); ysuccess(false);
free(path);
return; return;
} }
@ -946,6 +950,7 @@ void cmd_append_layout(I3_CMD, char *path) {
if (content == JSON_CONTENT_WORKSPACE) if (content == JSON_CONTENT_WORKSPACE)
ipc_send_workspace_event("restored", parent, NULL); ipc_send_workspace_event("restored", parent, NULL);
free(path);
cmd_output->needs_tree_render = true; cmd_output->needs_tree_render = true;
} }