aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Luminarys <kizunanohikari@gmail.com>2015-08-26 21:13:53 -0500
committerLibravatar Luminarys <kizunanohikari@gmail.com>2015-08-26 21:13:53 -0500
commit42de135c3a58ef0d58e96efb9ec9b75f2d1b5490 (patch)
tree47de34f845e1d4c43d06f1a5704f5d4764b34d31
parentslight fix (diff)
downloadsway-42de135c3a58ef0d58e96efb9ec9b75f2d1b5490.tar.gz
sway-42de135c3a58ef0d58e96efb9ec9b75f2d1b5490.tar.zst
sway-42de135c3a58ef0d58e96efb9ec9b75f2d1b5490.zip
Added in better versioning info
-rw-r--r--sway/ipc.c18
-rw-r--r--sway/main.c4
2 files changed, 19 insertions, 3 deletions
diff --git a/sway/ipc.c b/sway/ipc.c
index d278c0a0..44891005 100644
--- a/sway/ipc.c
+++ b/sway/ipc.c
@@ -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:
diff --git a/sway/main.c b/sway/main.c
index 3591e7ff..01c19074 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -78,8 +78,8 @@ int main(int argc, char **argv) {
78 debug = 1; 78 debug = 1;
79 break; 79 break;
80 case 'v': // version 80 case 'v': // version
81#ifdef SWAY_GIT_VERSION 81#if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE
82 fprintf(stdout, "sway build %s\n", SWAY_GIT_VERSION); 82 fprintf(stdout, "sway version %s (%s, branch \"%s\")\n", SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH);
83#else 83#else
84 fprintf(stdout, "version not detected\n"); 84 fprintf(stdout, "version not detected\n");
85#endif 85#endif