{"action":"created","comment":{"url":"https://api.github.com/repos/spaceconcordia/space-commander/pulls/comments/31861015","id":31861015,"diff_hunk":"@@ -237,3 +240,53 @@ void out_of_memory_handler()\n     throw bad_alloc();\n }\n \n+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n+ *\n+ * NAME : perform \n+ *\n+ * PURPOSE : validation\n+ *\n+ *-----------------------------------------------------------------------------*/\n+void validate() {\n+    bool isValid = true;\n+    struct stat stat_buf = {0};\n+\n+    // checks that the CS1_TGZ dir exists\n+    Shakespeare::log(Shakespeare::NOTICE, LOGNAME, \"validating CS1_TGZ directory existence\");\n+    if (stat(CS1_TGZ, &stat_buf) < 0 ) {\n+        \n+\n+        memset(log_buffer,0, MAX_BUFFER_SIZE);\n+        snprintf(log_buffer, MAX_BUFFER_SIZE, \"directory does not exist, creating : CS1_TGZ=%s\", CS1_TGZ);\n+        Shakespeare::log(Shakespeare::WARNING, LOGNAME, log_buffer);\n+\n+\n+        char cmd[CS1_PATH_MAX] = {0};\n+        snprintf(cmd, CS1_PATH_MAX, \"mkdir -p ./%s\", CS1_TGZ);\n+\n+\n+        if (system(cmd) != 0) {\n+            memset(log_buffer,0, MAX_BUFFER_SIZE);\n+            snprintf(log_buffer, MAX_BUFFER_SIZE, \"can't create directory : CS1_TGZ=%s\", cmd);\n+            Shakespeare::log(Shakespeare::ERROR, LOGNAME, log_buffer);\n+            isValid = false;\n+        }\n+    } else {\n+       if (!S_ISDIR(stat_buf.st_mode)) {\n+            memset(log_buffer,0, MAX_BUFFER_SIZE);\n+            snprintf(log_buffer, MAX_BUFFER_SIZE, \"file found while directory expected : CS1_TGZ=%s\\n\", CS1_TGZ);\n+            Shakespeare::log(Shakespeare::ERROR, LOGNAME, log_buffer);\n+            isValid = false;\n+        }\n+    }\n+\n+    if (!isValid) {\n+        memset(log_buffer,0, MAX_BUFFER_SIZE);\n+        snprintf(log_buffer, MAX_BUFFER_SIZE, \"exiting\");\n+        Shakespeare::log(Shakespeare::ERROR, LOGNAME, log_buffer);\n+        exit(1);","path":"src/space-commander/space-commander-main.cpp","position":null,"original_position":83,"commit_id":"cab570845778ab4eb32ff8c482c79427c476f917","original_commit_id":"8f34b0b8ca438649cc7ebd58550a274b00fecae2","user":{"login":"CandyRedTele","id":2866775,"avatar_url":"https://avatars.githubusercontent.com/u/2866775?v=3","gravatar_id":"","url":"https://api.github.com/users/CandyRedTele","html_url":"https://github.com/CandyRedTele","followers_url":"https://api.github.com/users/CandyRedTele/followers","following_url":"https://api.github.com/users/CandyRedTele/following{/other_user}","gists_url":"https://api.github.com/users/CandyRedTele/gists{/gist_id}","starred_url":"https://api.github.com/users/CandyRedTele/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CandyRedTele/subscriptions","organizations_url":"https://api.github.com/users/CandyRedTele/orgs","repos_url":"https://api.github.com/users/CandyRedTele/repos","events_url":"https://api.github.com/users/CandyRedTele/events{/privacy}","received_events_url":"https://api.github.com/users/CandyRedTele/received_events","type":"User","site_admin":false},"body":"Totally true ... changing this.","created_at":"2015-06-06T00:04:00Z","updated_at":"2015-06-06T00:04:00Z","html_url":"https://github.com/spaceconcordia/space-commander/pull/35#discussion_r31861015","pull_request_url":"https://api.github.com/repos/spaceconcordia/space-commander/pulls/35","_links":{"self":{"href":"https://api.github.com/repos/spaceconcordia/space-commander/pulls/comments/31861015"},"html":{"href":"https://github.com/spaceconcordia/space-commander/pull/35#discussion_r31861015"},"pull_request":{"href":"https://api.github.com/repos/spaceconcordia/space-commander/pulls/35"}}},"pull_request":{"url":"https://api.github.com/repos/spaceconcordia/space-commander/pulls/35","id":37064902,"html_url":"https://github.com/spaceconcordia/space-commander/pull/35","diff_url":"https://github.com/spaceconcordia/space-commander/pull/35.diff","patch_url":"https://github.com/spaceconcordia/space-commander/pull/35.patch","issue_url":"https://api.github.com/repos/spaceconcordia/space-commander/issues/35","number":35,"state":"open","locked":false,"title":"Validation","user":{"login":"CandyRedTele","id":2866775,"avatar_url":"https://avatars.githubusercontent.com/u/2866775?v=3","gravatar_id":"","url":"https://api.github.com/users/CandyRedTele","html_url":"https://github.com/CandyRedTele","followers_url":"https://api.github.com/users/CandyRedTele/followers","following_url":"https://api.github.com/users/CandyRedTele/following{/other_user}","gists_url":"https://api.github.com/users/CandyRedTele/gists{/gist_id}","starred_url":"https://api.github.com/users/CandyRedTele/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CandyRedTele/subscriptions","organizations_url":"https://api.github.com/users/CandyRedTele/orgs","repos_url":"https://api.github.com/users/CandyRedTele/repos","events_url":"https://api.github.com/users/CandyRedTele/events{/privacy}","received_events_url":"https://api.github.com/users/CandyRedTele/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-05T20:01:11Z","updated_at":"2015-06-06T00:04:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"47d3d4db0648f9b1c9e1d6fed769a34577c28691","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/spaceconcordia/space-commander/pulls/35/commits","review_comments_url":"https://api.github.com/repos/spaceconcordia/space-commander/pulls/35/comments","review_comment_url":"https://api.github.com/repos/spaceconcordia/space-commander/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spaceconcordia/space-commander/issues/35/comments","statuses_url":"https://api.github.com/repos/spaceconcordia/space-commander/statuses/cab570845778ab4eb32ff8c482c79427c476f917","head":{"label":"CandyRedTele:validation","ref":"validation","sha":"cab570845778ab4eb32ff8c482c79427c476f917","user":{"login":"CandyRedTele","id":2866775,"avatar_url":"https://avatars.githubusercontent.com/u/2866775?v=3","gravatar_id":"","url":"https://api.github.com/users/CandyRedTele","html_url":"https://github.com/CandyRedTele","followers_url":"https://api.github.com/users/CandyRedTele/followers","following_url":"https://api.github.com/users/CandyRedTele/following{/other_user}","gists_url":"https://api.github.com/users/CandyRedTele/gists{/gist_id}","starred_url":"https://api.github.com/users/CandyRedTele/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CandyRedTele/subscriptions","organizations_url":"https://api.github.com/users/CandyRedTele/orgs","repos_url":"https://api.github.com/users/CandyRedTele/repos","events_url":"https://api.github.com/users/CandyRedTele/events{/privacy}","received_events_url":"https://api.github.com/users/CandyRedTele/received_events","type":"User","site_admin":false},"repo":{"id":34185241,"name":"space-commander","full_name":"CandyRedTele/space-commander","owner":{"login":"CandyRedTele","id":2866775,"avatar_url":"https://avatars.githubusercontent.com/u/2866775?v=3","gravatar_id":"","url":"https://api.github.com/users/CandyRedTele","html_url":"https://github.com/CandyRedTele","followers_url":"https://api.github.com/users/CandyRedTele/followers","following_url":"https://api.github.com/users/CandyRedTele/following{/other_user}","gists_url":"https://api.github.com/users/CandyRedTele/gists{/gist_id}","starred_url":"https://api.github.com/users/CandyRedTele/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CandyRedTele/subscriptions","organizations_url":"https://api.github.com/users/CandyRedTele/orgs","repos_url":"https://api.github.com/users/CandyRedTele/repos","events_url":"https://api.github.com/users/CandyRedTele/events{/privacy}","received_events_url":"https://api.github.com/users/CandyRedTele/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/CandyRedTele/space-commander","description":"net2com","fork":true,"url":"https://api.github.com/repos/CandyRedTele/space-commander","forks_url":"https://api.github.com/repos/CandyRedTele/space-commander/forks","keys_url":"https://api.github.com/repos/CandyRedTele/space-commander/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CandyRedTele/space-commander/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CandyRedTele/space-commander/teams","hooks_url":"https://api.github.com/repos/CandyRedTele/space-commander/hooks","issue_events_url":"https://api.github.com/repos/CandyRedTele/space-commander/issues/events{/number}","events_url":"https://api.github.com/repos/CandyRedTele/space-commander/events","assignees_url":"https://api.github.com/repos/CandyRedTele/space-commander/assignees{/user}","branches_url":"https://api.github.com/repos/CandyRedTele/space-commander/branches{/branch}","tags_url":"https://api.github.com/repos/CandyRedTele/space-commander/tags","blobs_url":"https://api.github.com/repos/CandyRedTele/space-commander/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CandyRedTele/space-commander/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CandyRedTele/space-commander/git/refs{/sha}","trees_url":"https://api.github.com/repos/CandyRedTele/space-commander/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CandyRedTele/space-commander/statuses/{sha}","languages_url":"https://api.github.com/repos/CandyRedTele/space-commander/languages","stargazers_url":"https://api.github.com/repos/CandyRedTele/space-commander/stargazers","contributors_url":"https://api.github.com/repos/CandyRedTele/space-commander/contributors","subscribers_url":"https://api.github.com/repos/CandyRedTele/space-commander/subscribers","subscription_url":"https://api.github.com/repos/CandyRedTele/space-commander/subscription","commits_url":"https://api.github.com/repos/CandyRedTele/space-commander/commits{/sha}","git_commits_url":"https://api.github.com/repos/CandyRedTele/space-commander/git/commits{/sha}","comments_url":"https://api.github.com/repos/CandyRedTele/space-commander/comments{/number}","issue_comment_url":"https://api.github.com/repos/CandyRedTele/space-commander/issues/comments{/number}","contents_url":"https://api.github.com/repos/CandyRedTele/space-commander/contents/{+path}","compare_url":"https://api.github.com/repos/CandyRedTele/space-commander/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CandyRedTele/space-commander/merges","archive_url":"https://api.github.com/repos/CandyRedTele/space-commander/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CandyRedTele/space-commander/downloads","issues_url":"https://api.github.com/repos/CandyRedTele/space-commander/issues{/number}","pulls_url":"https://api.github.com/repos/CandyRedTele/space-commander/pulls{/number}","milestones_url":"https://api.github.com/repos/CandyRedTele/space-commander/milestones{/number}","notifications_url":"https://api.github.com/repos/CandyRedTele/space-commander/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CandyRedTele/space-commander/labels{/name}","releases_url":"https://api.github.com/repos/CandyRedTele/space-commander/releases{/id}","created_at":"2015-04-18T22:28:58Z","updated_at":"2015-04-18T22:28:59Z","pushed_at":"2015-06-05T21:05:42Z","git_url":"git://github.com/CandyRedTele/space-commander.git","ssh_url":"git@github.com:CandyRedTele/space-commander.git","clone_url":"https://github.com/CandyRedTele/space-commander.git","svn_url":"https://github.com/CandyRedTele/space-commander","homepage":"","size":2086,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"spaceconcordia:master","ref":"master","sha":"b036d79b7f56b6d560ff0716f4dad718a1a8a1e6","user":{"login":"spaceconcordia","id":600927,"avatar_url":"https://avatars.githubusercontent.com/u/600927?v=3","gravatar_id":"","url":"https://api.github.com/users/spaceconcordia","html_url":"https://github.com/spaceconcordia","followers_url":"https://api.github.com/users/spaceconcordia/followers","following_url":"https://api.github.com/users/spaceconcordia/following{/other_user}","gists_url":"https://api.github.com/users/spaceconcordia/gists{/gist_id}","starred_url":"https://api.github.com/users/spaceconcordia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spaceconcordia/subscriptions","organizations_url":"https://api.github.com/users/spaceconcordia/orgs","repos_url":"https://api.github.com/users/spaceconcordia/repos","events_url":"https://api.github.com/users/spaceconcordia/events{/privacy}","received_events_url":"https://api.github.com/users/spaceconcordia/received_events","type":"Organization","site_admin":false},"repo":{"id":8396537,"name":"space-commander","full_name":"spaceconcordia/space-commander","owner":{"login":"spaceconcordia","id":600927,"avatar_url":"https://avatars.githubusercontent.com/u/600927?v=3","gravatar_id":"","url":"https://api.github.com/users/spaceconcordia","html_url":"https://github.com/spaceconcordia","followers_url":"https://api.github.com/users/spaceconcordia/followers","following_url":"https://api.github.com/users/spaceconcordia/following{/other_user}","gists_url":"https://api.github.com/users/spaceconcordia/gists{/gist_id}","starred_url":"https://api.github.com/users/spaceconcordia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spaceconcordia/subscriptions","organizations_url":"https://api.github.com/users/spaceconcordia/orgs","repos_url":"https://api.github.com/users/spaceconcordia/repos","events_url":"https://api.github.com/users/spaceconcordia/events{/privacy}","received_events_url":"https://api.github.com/users/spaceconcordia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spaceconcordia/space-commander","description":"net2com","fork":false,"url":"https://api.github.com/repos/spaceconcordia/space-commander","forks_url":"https://api.github.com/repos/spaceconcordia/space-commander/forks","keys_url":"https://api.github.com/repos/spaceconcordia/space-commander/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spaceconcordia/space-commander/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spaceconcordia/space-commander/teams","hooks_url":"https://api.github.com/repos/spaceconcordia/space-commander/hooks","issue_events_url":"https://api.github.com/repos/spaceconcordia/space-commander/issues/events{/number}","events_url":"https://api.github.com/repos/spaceconcordia/space-commander/events","assignees_url":"https://api.github.com/repos/spaceconcordia/space-commander/assignees{/user}","branches_url":"https://api.github.com/repos/spaceconcordia/space-commander/branches{/branch}","tags_url":"https://api.github.com/repos/spaceconcordia/space-commander/tags","blobs_url":"https://api.github.com/repos/spaceconcordia/space-commander/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spaceconcordia/space-commander/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spaceconcordia/space-commander/git/refs{/sha}","trees_url":"https://api.github.com/repos/spaceconcordia/space-commander/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spaceconcordia/space-commander/statuses/{sha}","languages_url":"https://api.github.com/repos/spaceconcordia/space-commander/languages","stargazers_url":"https://api.github.com/repos/spaceconcordia/space-commander/stargazers","contributors_url":"https://api.github.com/repos/spaceconcordia/space-commander/contributors","subscribers_url":"https://api.github.com/repos/spaceconcordia/space-commander/subscribers","subscription_url":"https://api.github.com/repos/spaceconcordia/space-commander/subscription","commits_url":"https://api.github.com/repos/spaceconcordia/space-commander/commits{/sha}","git_commits_url":"https://api.github.com/repos/spaceconcordia/space-commander/git/commits{/sha}","comments_url":"https://api.github.com/repos/spaceconcordia/space-commander/comments{/number}","issue_comment_url":"https://api.github.com/repos/spaceconcordia/space-commander/issues/comments{/number}","contents_url":"https://api.github.com/repos/spaceconcordia/space-commander/contents/{+path}","compare_url":"https://api.github.com/repos/spaceconcordia/space-commander/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spaceconcordia/space-commander/merges","archive_url":"https://api.github.com/repos/spaceconcordia/space-commander/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spaceconcordia/space-commander/downloads","issues_url":"https://api.github.com/repos/spaceconcordia/space-commander/issues{/number}","pulls_url":"https://api.github.com/repos/spaceconcordia/space-commander/pulls{/number}","milestones_url":"https://api.github.com/repos/spaceconcordia/space-commander/milestones{/number}","notifications_url":"https://api.github.com/repos/spaceconcordia/space-commander/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spaceconcordia/space-commander/labels{/name}","releases_url":"https://api.github.com/repos/spaceconcordia/space-commander/releases{/id}","created_at":"2013-02-24T20:49:56Z","updated_at":"2015-05-07T04:31:19Z","pushed_at":"2015-06-05T21:05:42Z","git_url":"git://github.com/spaceconcordia/space-commander.git","ssh_url":"git@github.com:spaceconcordia/space-commander.git","clone_url":"https://github.com/spaceconcordia/space-commander.git","svn_url":"https://github.com/spaceconcordia/space-commander","homepage":"","size":3456,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":9,"forks":2,"open_issues":9,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spaceconcordia/space-commander/pulls/35"},"html":{"href":"https://github.com/spaceconcordia/space-commander/pull/35"},"issue":{"href":"https://api.github.com/repos/spaceconcordia/space-commander/issues/35"},"comments":{"href":"https://api.github.com/repos/spaceconcordia/space-commander/issues/35/comments"},"review_comments":{"href":"https://api.github.com/repos/spaceconcordia/space-commander/pulls/35/comments"},"review_comment":{"href":"https://api.github.com/repos/spaceconcordia/space-commander/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spaceconcordia/space-commander/pulls/35/commits"},"statuses":{"href":"https://api.github.com/repos/spaceconcordia/space-commander/statuses/cab570845778ab4eb32ff8c482c79427c476f917"}}}}