{"action":"created","comment":{"url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/pulls/comments/49279263","id":49279263,"diff_hunk":"@@ -161,13 +165,78 @@ bool platform_ensure_directory_exists(const utf8 *path)\n \n bool platform_directory_delete(const utf8 *path)\n {\n-\tSTUB();\n-\treturn true;\n+\tlog_verbose(\"Recursively deleting directory %s\", path);\n+\n+\tFTS *ftsp;\n+\tFTSENT *p, *chp;\n+\n+\t// fts_open only accepts non const paths, so we have to take a copy\n+\tchar* ourPath = (char*)malloc(strlen(path) + 1);\n+\tstrcpy(ourPath, path);\n+\n+\tutf8* const patharray[2] = {ourPath, NULL};\n+\tif ((ftsp = fts_open(patharray, FTS_COMFOLLOW | FTS_LOGICAL | FTS_NOCHDIR, NULL)) == NULL) {\n+\t\tlog_error(\"fts_open returned NULL\");\n+\t\treturn 0;\n+\t}\n+\n+\tchp = fts_children(ftsp, 0);\n+\tif (chp == NULL) {\n+\t\tlog_verbose(\"No files to traverse, deleting directory %s\", path);\n+\t\tremove(path);\n+\t\treturn 1; // No files to traverse\n+\t}\n+\n+\twhile ((p = fts_read(ftsp)) != NULL) {\n+\t\tswitch (p->fts_info) {\n+\t\t\tcase FTS_DP: // Directory postorder, which means\n+\t\t\t\t\t\t // the directory is empty\n+\t\t\t\t\t\t \n+\t\t\tcase FTS_F:  // File\n+\t\t\t\tif(remove(p->fts_path)) {\n+\t\t\t\t\tlog_error(\"Could not remove %s\", p->fts_path);\n+\t\t\t\t\tfts_close(ftsp);\n+\t\t\t\t\tfree(ourPath);\n+\t\t\t\t\treturn 0;\n+\t\t\t\t}\n+\t\t\t\tbreak;\n+\t\t\tcase FTS_ERR:\n+\t\t\t\tlog_error(\"Error traversing %s\", path);\n+\t\t\t\tfts_close(ftsp);\n+\t\t\t\tfree(ourPath);\n+\t\t\t\treturn 0;\n+\t\t}\n+\t}\n+\n+\tfree(ourPath);\n+\tfts_close(ftsp);\n+\n+\treturn 1;\n }\n \n bool platform_lock_single_instance()\n {\n-\tSTUB();\n+\tchar pidFilePath[MAX_PATH];\n+\tchar separator = platform_get_path_separator();\n+\n+\tstrncpy(pidFilePath, _userDataDirectoryPath, MAX_PATH);\n+\tstrncat(pidFilePath, &separator, 1);\n+\tstrncat(pidFilePath, \"openrct2.lock\", \n+\t\t\tMAX_PATH - strnlen(pidFilePath, MAX_PATH) - 1);\n+\n+\tint pidFile = open(pidFilePath, O_CREAT | O_RDWR, 0666);","path":"src/platform/posix.c","position":94,"original_position":94,"commit_id":"a43653bc219c5bbc0c5c977b75836cda56342fce","original_commit_id":"a43653bc219c5bbc0c5c977b75836cda56342fce","user":{"login":"janisozaur","id":550290,"avatar_url":"https://avatars.githubusercontent.com/u/550290?v=3","gravatar_id":"","url":"https://api.github.com/users/janisozaur","html_url":"https://github.com/janisozaur","followers_url":"https://api.github.com/users/janisozaur/followers","following_url":"https://api.github.com/users/janisozaur/following{/other_user}","gists_url":"https://api.github.com/users/janisozaur/gists{/gist_id}","starred_url":"https://api.github.com/users/janisozaur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janisozaur/subscriptions","organizations_url":"https://api.github.com/users/janisozaur/orgs","repos_url":"https://api.github.com/users/janisozaur/repos","events_url":"https://api.github.com/users/janisozaur/events{/privacy}","received_events_url":"https://api.github.com/users/janisozaur/received_events","type":"User","site_admin":false},"body":"`pidFile` never gets closed, is this required for `flock` to work or a mistake? If the former, please add a comment specifying this.","created_at":"2016-01-10T18:18:12Z","updated_at":"2016-01-10T18:18:12Z","html_url":"https://github.com/OpenRCT2/OpenRCT2/pull/2648#discussion_r49279263","pull_request_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/pulls/2648","_links":{"self":{"href":"https://api.github.com/repos/OpenRCT2/OpenRCT2/pulls/comments/49279263"},"html":{"href":"https://github.com/OpenRCT2/OpenRCT2/pull/2648#discussion_r49279263"},"pull_request":{"href":"https://api.github.com/repos/OpenRCT2/OpenRCT2/pulls/2648"}}},"pull_request":{"url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/pulls/2648","id":55075548,"html_url":"https://github.com/OpenRCT2/OpenRCT2/pull/2648","diff_url":"https://github.com/OpenRCT2/OpenRCT2/pull/2648.diff","patch_url":"https://github.com/OpenRCT2/OpenRCT2/pull/2648.patch","issue_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/issues/2648","number":2648,"state":"open","locked":false,"title":"Implement several POSIX methods.","user":{"login":"rubdos","id":1263440,"avatar_url":"https://avatars.githubusercontent.com/u/1263440?v=3","gravatar_id":"","url":"https://api.github.com/users/rubdos","html_url":"https://github.com/rubdos","followers_url":"https://api.github.com/users/rubdos/followers","following_url":"https://api.github.com/users/rubdos/following{/other_user}","gists_url":"https://api.github.com/users/rubdos/gists{/gist_id}","starred_url":"https://api.github.com/users/rubdos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubdos/subscriptions","organizations_url":"https://api.github.com/users/rubdos/orgs","repos_url":"https://api.github.com/users/rubdos/repos","events_url":"https://api.github.com/users/rubdos/events{/privacy}","received_events_url":"https://api.github.com/users/rubdos/received_events","type":"User","site_admin":false},"body":"I'm working on posix.c to get rid of most of the STUB() calls there.\r\n\r\nWhat's done for now:\r\n- Implement file copy on POSIX systems; autosave should work now on Mac OS X and Linux. (tested on Arch Linux)","created_at":"2016-01-05T10:28:31Z","updated_at":"2016-01-10T18:18:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"27c87bfc7c8dbcf80f6fc71f1089d33ae8ec28e8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/pulls/2648/commits","review_comments_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/pulls/2648/comments","review_comment_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/issues/2648/comments","statuses_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/statuses/a43653bc219c5bbc0c5c977b75836cda56342fce","head":{"label":"rubdos:POSIX_platform","ref":"POSIX_platform","sha":"a43653bc219c5bbc0c5c977b75836cda56342fce","user":{"login":"rubdos","id":1263440,"avatar_url":"https://avatars.githubusercontent.com/u/1263440?v=3","gravatar_id":"","url":"https://api.github.com/users/rubdos","html_url":"https://github.com/rubdos","followers_url":"https://api.github.com/users/rubdos/followers","following_url":"https://api.github.com/users/rubdos/following{/other_user}","gists_url":"https://api.github.com/users/rubdos/gists{/gist_id}","starred_url":"https://api.github.com/users/rubdos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubdos/subscriptions","organizations_url":"https://api.github.com/users/rubdos/orgs","repos_url":"https://api.github.com/users/rubdos/repos","events_url":"https://api.github.com/users/rubdos/events{/privacy}","received_events_url":"https://api.github.com/users/rubdos/received_events","type":"User","site_admin":false},"repo":{"id":49056001,"name":"OpenRCT2","full_name":"rubdos/OpenRCT2","owner":{"login":"rubdos","id":1263440,"avatar_url":"https://avatars.githubusercontent.com/u/1263440?v=3","gravatar_id":"","url":"https://api.github.com/users/rubdos","html_url":"https://github.com/rubdos","followers_url":"https://api.github.com/users/rubdos/followers","following_url":"https://api.github.com/users/rubdos/following{/other_user}","gists_url":"https://api.github.com/users/rubdos/gists{/gist_id}","starred_url":"https://api.github.com/users/rubdos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubdos/subscriptions","organizations_url":"https://api.github.com/users/rubdos/orgs","repos_url":"https://api.github.com/users/rubdos/repos","events_url":"https://api.github.com/users/rubdos/events{/privacy}","received_events_url":"https://api.github.com/users/rubdos/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rubdos/OpenRCT2","description":"An open source re-implementation of Roller Coaster Tycoon 2.","fork":true,"url":"https://api.github.com/repos/rubdos/OpenRCT2","forks_url":"https://api.github.com/repos/rubdos/OpenRCT2/forks","keys_url":"https://api.github.com/repos/rubdos/OpenRCT2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rubdos/OpenRCT2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rubdos/OpenRCT2/teams","hooks_url":"https://api.github.com/repos/rubdos/OpenRCT2/hooks","issue_events_url":"https://api.github.com/repos/rubdos/OpenRCT2/issues/events{/number}","events_url":"https://api.github.com/repos/rubdos/OpenRCT2/events","assignees_url":"https://api.github.com/repos/rubdos/OpenRCT2/assignees{/user}","branches_url":"https://api.github.com/repos/rubdos/OpenRCT2/branches{/branch}","tags_url":"https://api.github.com/repos/rubdos/OpenRCT2/tags","blobs_url":"https://api.github.com/repos/rubdos/OpenRCT2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rubdos/OpenRCT2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rubdos/OpenRCT2/git/refs{/sha}","trees_url":"https://api.github.com/repos/rubdos/OpenRCT2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rubdos/OpenRCT2/statuses/{sha}","languages_url":"https://api.github.com/repos/rubdos/OpenRCT2/languages","stargazers_url":"https://api.github.com/repos/rubdos/OpenRCT2/stargazers","contributors_url":"https://api.github.com/repos/rubdos/OpenRCT2/contributors","subscribers_url":"https://api.github.com/repos/rubdos/OpenRCT2/subscribers","subscription_url":"https://api.github.com/repos/rubdos/OpenRCT2/subscription","commits_url":"https://api.github.com/repos/rubdos/OpenRCT2/commits{/sha}","git_commits_url":"https://api.github.com/repos/rubdos/OpenRCT2/git/commits{/sha}","comments_url":"https://api.github.com/repos/rubdos/OpenRCT2/comments{/number}","issue_comment_url":"https://api.github.com/repos/rubdos/OpenRCT2/issues/comments{/number}","contents_url":"https://api.github.com/repos/rubdos/OpenRCT2/contents/{+path}","compare_url":"https://api.github.com/repos/rubdos/OpenRCT2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rubdos/OpenRCT2/merges","archive_url":"https://api.github.com/repos/rubdos/OpenRCT2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rubdos/OpenRCT2/downloads","issues_url":"https://api.github.com/repos/rubdos/OpenRCT2/issues{/number}","pulls_url":"https://api.github.com/repos/rubdos/OpenRCT2/pulls{/number}","milestones_url":"https://api.github.com/repos/rubdos/OpenRCT2/milestones{/number}","notifications_url":"https://api.github.com/repos/rubdos/OpenRCT2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rubdos/OpenRCT2/labels{/name}","releases_url":"https://api.github.com/repos/rubdos/OpenRCT2/releases{/id}","created_at":"2016-01-05T09:31:14Z","updated_at":"2016-01-05T09:31:17Z","pushed_at":"2016-01-09T08:51:57Z","git_url":"git://github.com/rubdos/OpenRCT2.git","ssh_url":"git@github.com:rubdos/OpenRCT2.git","clone_url":"https://github.com/rubdos/OpenRCT2.git","svn_url":"https://github.com/rubdos/OpenRCT2","homepage":"http://openrct2.website","size":34465,"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":"develop"}},"base":{"label":"OpenRCT2:develop","ref":"develop","sha":"19c38e0b348f5fd822949ccfa1c00b76db002768","user":{"login":"OpenRCT2","id":8473908,"avatar_url":"https://avatars.githubusercontent.com/u/8473908?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenRCT2","html_url":"https://github.com/OpenRCT2","followers_url":"https://api.github.com/users/OpenRCT2/followers","following_url":"https://api.github.com/users/OpenRCT2/following{/other_user}","gists_url":"https://api.github.com/users/OpenRCT2/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenRCT2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenRCT2/subscriptions","organizations_url":"https://api.github.com/users/OpenRCT2/orgs","repos_url":"https://api.github.com/users/OpenRCT2/repos","events_url":"https://api.github.com/users/OpenRCT2/events{/privacy}","received_events_url":"https://api.github.com/users/OpenRCT2/received_events","type":"Organization","site_admin":false},"repo":{"id":18348651,"name":"OpenRCT2","full_name":"OpenRCT2/OpenRCT2","owner":{"login":"OpenRCT2","id":8473908,"avatar_url":"https://avatars.githubusercontent.com/u/8473908?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenRCT2","html_url":"https://github.com/OpenRCT2","followers_url":"https://api.github.com/users/OpenRCT2/followers","following_url":"https://api.github.com/users/OpenRCT2/following{/other_user}","gists_url":"https://api.github.com/users/OpenRCT2/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenRCT2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenRCT2/subscriptions","organizations_url":"https://api.github.com/users/OpenRCT2/orgs","repos_url":"https://api.github.com/users/OpenRCT2/repos","events_url":"https://api.github.com/users/OpenRCT2/events{/privacy}","received_events_url":"https://api.github.com/users/OpenRCT2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenRCT2/OpenRCT2","description":"An open source re-implementation of Roller Coaster Tycoon 2.","fork":false,"url":"https://api.github.com/repos/OpenRCT2/OpenRCT2","forks_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/forks","keys_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/teams","hooks_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/hooks","issue_events_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/issues/events{/number}","events_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/events","assignees_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/assignees{/user}","branches_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/branches{/branch}","tags_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/tags","blobs_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/languages","stargazers_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/stargazers","contributors_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/contributors","subscribers_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/subscribers","subscription_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/subscription","commits_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/contents/{+path}","compare_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/merges","archive_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/downloads","issues_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/issues{/number}","pulls_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/labels{/name}","releases_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/releases{/id}","created_at":"2014-04-01T23:32:25Z","updated_at":"2016-01-10T16:34:55Z","pushed_at":"2016-01-10T17:54:55Z","git_url":"git://github.com/OpenRCT2/OpenRCT2.git","ssh_url":"git@github.com:OpenRCT2/OpenRCT2.git","clone_url":"https://github.com/OpenRCT2/OpenRCT2.git","svn_url":"https://github.com/OpenRCT2/OpenRCT2","homepage":"http://openrct2.website","size":45300,"stargazers_count":1438,"watchers_count":1438,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":263,"mirror_url":null,"open_issues_count":343,"forks":263,"open_issues":343,"watchers":1438,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenRCT2/OpenRCT2/pulls/2648"},"html":{"href":"https://github.com/OpenRCT2/OpenRCT2/pull/2648"},"issue":{"href":"https://api.github.com/repos/OpenRCT2/OpenRCT2/issues/2648"},"comments":{"href":"https://api.github.com/repos/OpenRCT2/OpenRCT2/issues/2648/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenRCT2/OpenRCT2/pulls/2648/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenRCT2/OpenRCT2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenRCT2/OpenRCT2/pulls/2648/commits"},"statuses":{"href":"https://api.github.com/repos/OpenRCT2/OpenRCT2/statuses/a43653bc219c5bbc0c5c977b75836cda56342fce"}}}}