diff options
author | Luminarys <kizunanohikari@gmail.com> | 2015-08-26 21:13:53 -0500 |
---|---|---|
committer | Luminarys <kizunanohikari@gmail.com> | 2015-08-26 21:13:53 -0500 |
commit | 42de135c3a58ef0d58e96efb9ec9b75f2d1b5490 (patch) | |
tree | 47de34f845e1d4c43d06f1a5704f5d4764b34d31 /sway/ipc.c | |
parent | slight fix (diff) | |
download | sway-42de135c3a58ef0d58e96efb9ec9b75f2d1b5490.tar.gz sway-42de135c3a58ef0d58e96efb9ec9b75f2d1b5490.tar.zst sway-42de135c3a58ef0d58e96efb9ec9b75f2d1b5490.zip |
Added in better versioning info
Diffstat (limited to 'sway/ipc.c')
-rw-r--r-- | sway/ipc.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -225,14 +225,30 @@ void ipc_client_handle_command(struct ipc_client *client) { | |||
225 | } | 225 | } |
226 | case IPC_GET_VERSION: | 226 | case IPC_GET_VERSION: |
227 | { | 227 | { |
228 | #if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE | ||
229 | char *full_version = calloc(strlen(SWAY_GIT_VERSION) + strlen(SWAY_GIT_BRANCH) + strlen(SWAY_VERSION_DATE) + 20, 1); | ||
230 | strcat(full_version, SWAY_GIT_VERSION); | ||
231 | strcat(full_version, " ("); | ||
232 | strcat(full_version, SWAY_VERSION_DATE); | ||
233 | strcat(full_version, ", branch \""); | ||
234 | strcat(full_version, SWAY_GIT_BRANCH); | ||
235 | strcat(full_version, "\")"); | ||
228 | json_object *json = json_object_new_object(); | 236 | json_object *json = json_object_new_object(); |
229 | json_object_object_add(json, "human_readable", json_object_new_string(SWAY_GIT_VERSION)); | 237 | json_object_object_add(json, "human_readable", json_object_new_string(full_version)); |
238 | // Todo once we actually release a version | ||
230 | json_object_object_add(json, "major", json_object_new_int(0)); | 239 | json_object_object_add(json, "major", json_object_new_int(0)); |
231 | json_object_object_add(json, "minor", json_object_new_int(0)); | 240 | json_object_object_add(json, "minor", json_object_new_int(0)); |
232 | json_object_object_add(json, "patch", json_object_new_int(1)); | 241 | json_object_object_add(json, "patch", json_object_new_int(1)); |
242 | #else | ||
243 | json_object_object_add(json, "human_readable", json_object_new_string("version not found")); | ||
244 | json_object_object_add(json, "major", json_object_new_int(0)); | ||
245 | json_object_object_add(json, "minor", json_object_new_int(0)); | ||
246 | json_object_object_add(json, "patch", json_object_new_int(0)); | ||
247 | #endif | ||
233 | const char *json_string = json_object_to_json_string(json); | 248 | const char *json_string = json_object_to_json_string(json); |
234 | ipc_send_reply(client, json_string, (uint32_t) strlen(json_string)); | 249 | ipc_send_reply(client, json_string, (uint32_t) strlen(json_string)); |
235 | json_object_put(json); // free | 250 | json_object_put(json); // free |
251 | free(full_version); | ||
236 | break; | 252 | break; |
237 | } | 253 | } |
238 | default: | 254 | default: |