{"action":"created","comment":{"url":"https://api.github.com/repos/micropython/micropython/pulls/comments/64612244","id":64612244,"diff_hunk":"@@ -111,22 +114,123 @@ STATIC mp_obj_t fat_vfs_mkdir(mp_obj_t vfs_in, mp_obj_t path_o) {\n     switch (res) {\n         case FR_OK:\n             return mp_const_none;\n-        case FR_EXIST:\n-            // TODO should be FileExistsError\n-            nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, \"File exists: '%s'\", path));\n         default:\n-            nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, \"Error creating directory '%s'\", path));\n+            nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError,\n+                MP_OBJ_NEW_SMALL_INT(fresult_to_errno_table[res])));\n     }\n }\n STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_mkdir_obj, fat_vfs_mkdir);\n \n+STATIC mp_obj_t fat_vfs_chdir(mp_obj_t vfs_in, mp_obj_t path_o) {\n+    (void)vfs_in;\n+    const char *path = mp_obj_str_get_str(path_o);\n+    FRESULT res = f_chdir(path);\n+    switch (res) {\n+        case FR_OK:\n+            return mp_const_none;\n+        default:\n+            nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError,\n+                MP_OBJ_NEW_SMALL_INT(fresult_to_errno_table[res])));\n+    }\n+}\n+STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_chdir_obj, fat_vfs_chdir);\n+\n+// Checks for path equality, ignoring trailing slashes:\n+//   path_equal(/, /) -> true\n+// second argument must be in canonical form (meaning no trailing slash, unless it's just /)\n+STATIC bool path_equal(const char *path, const char *path_canonical) {\n+    for (; *path_canonical != '\\0' && *path == *path_canonical; ++path, ++path_canonical) {","path":"extmod/vfs_fat.c","position":71,"original_position":71,"commit_id":"8378dd8dcf623b5e2c178f5f00a92b3bc1039139","original_commit_id":"8378dd8dcf623b5e2c178f5f00a92b3bc1039139","user":{"login":"pfalcon","id":500451,"avatar_url":"https://avatars.githubusercontent.com/u/500451?v=3","gravatar_id":"","url":"https://api.github.com/users/pfalcon","html_url":"https://github.com/pfalcon","followers_url":"https://api.github.com/users/pfalcon/followers","following_url":"https://api.github.com/users/pfalcon/following{/other_user}","gists_url":"https://api.github.com/users/pfalcon/gists{/gist_id}","starred_url":"https://api.github.com/users/pfalcon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfalcon/subscriptions","organizations_url":"https://api.github.com/users/pfalcon/orgs","repos_url":"https://api.github.com/users/pfalcon/repos","events_url":"https://api.github.com/users/pfalcon/events{/privacy}","received_events_url":"https://api.github.com/users/pfalcon/received_events","type":"User","site_admin":false},"body":"Well, sounds good then ;-).","created_at":"2016-05-25T17:05:45Z","updated_at":"2016-05-25T17:05:45Z","html_url":"https://github.com/micropython/micropython/pull/2110#discussion_r64612244","pull_request_url":"https://api.github.com/repos/micropython/micropython/pulls/2110","_links":{"self":{"href":"https://api.github.com/repos/micropython/micropython/pulls/comments/64612244"},"html":{"href":"https://github.com/micropython/micropython/pull/2110#discussion_r64612244"},"pull_request":{"href":"https://api.github.com/repos/micropython/micropython/pulls/2110"}}},"pull_request":{"url":"https://api.github.com/repos/micropython/micropython/pulls/2110","id":71420321,"html_url":"https://github.com/micropython/micropython/pull/2110","diff_url":"https://github.com/micropython/micropython/pull/2110.diff","patch_url":"https://github.com/micropython/micropython/pull/2110.patch","issue_url":"https://api.github.com/repos/micropython/micropython/issues/2110","number":2110,"state":"open","locked":false,"title":"esp8266: Add stat(), chdir() and rmdir() to module uos and vfs","user":{"login":"robert-hh","id":12476868,"avatar_url":"https://avatars.githubusercontent.com/u/12476868?v=3","gravatar_id":"","url":"https://api.github.com/users/robert-hh","html_url":"https://github.com/robert-hh","followers_url":"https://api.github.com/users/robert-hh/followers","following_url":"https://api.github.com/users/robert-hh/following{/other_user}","gists_url":"https://api.github.com/users/robert-hh/gists{/gist_id}","starred_url":"https://api.github.com/users/robert-hh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robert-hh/subscriptions","organizations_url":"https://api.github.com/users/robert-hh/orgs","repos_url":"https://api.github.com/users/robert-hh/repos","events_url":"https://api.github.com/users/robert-hh/events{/privacy}","received_events_url":"https://api.github.com/users/robert-hh/received_events","type":"User","site_admin":false},"body":"    esp8266/moduos.c:\r\n        added proxy stubs for stat() and chdir(), and an alias for rmdir()\r\n    extmod/vfs_fat.c:\r\n        - added the functions fo stat() and chdir() and an alias for rmdir()\r\n        - replaced the text error messages by the Posix error numbers using\r\n          the mechanism already provided","created_at":"2016-05-25T16:15:07Z","updated_at":"2016-05-25T17:05:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"42f384a1960006092f3dd55a287d341c41ee88fd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/micropython/micropython/pulls/2110/commits","review_comments_url":"https://api.github.com/repos/micropython/micropython/pulls/2110/comments","review_comment_url":"https://api.github.com/repos/micropython/micropython/pulls/comments{/number}","comments_url":"https://api.github.com/repos/micropython/micropython/issues/2110/comments","statuses_url":"https://api.github.com/repos/micropython/micropython/statuses/8378dd8dcf623b5e2c178f5f00a92b3bc1039139","head":{"label":"robert-hh:master","ref":"master","sha":"8378dd8dcf623b5e2c178f5f00a92b3bc1039139","user":{"login":"robert-hh","id":12476868,"avatar_url":"https://avatars.githubusercontent.com/u/12476868?v=3","gravatar_id":"","url":"https://api.github.com/users/robert-hh","html_url":"https://github.com/robert-hh","followers_url":"https://api.github.com/users/robert-hh/followers","following_url":"https://api.github.com/users/robert-hh/following{/other_user}","gists_url":"https://api.github.com/users/robert-hh/gists{/gist_id}","starred_url":"https://api.github.com/users/robert-hh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robert-hh/subscriptions","organizations_url":"https://api.github.com/users/robert-hh/orgs","repos_url":"https://api.github.com/users/robert-hh/repos","events_url":"https://api.github.com/users/robert-hh/events{/privacy}","received_events_url":"https://api.github.com/users/robert-hh/received_events","type":"User","site_admin":false},"repo":{"id":59633924,"name":"micropython","full_name":"robert-hh/micropython","owner":{"login":"robert-hh","id":12476868,"avatar_url":"https://avatars.githubusercontent.com/u/12476868?v=3","gravatar_id":"","url":"https://api.github.com/users/robert-hh","html_url":"https://github.com/robert-hh","followers_url":"https://api.github.com/users/robert-hh/followers","following_url":"https://api.github.com/users/robert-hh/following{/other_user}","gists_url":"https://api.github.com/users/robert-hh/gists{/gist_id}","starred_url":"https://api.github.com/users/robert-hh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robert-hh/subscriptions","organizations_url":"https://api.github.com/users/robert-hh/orgs","repos_url":"https://api.github.com/users/robert-hh/repos","events_url":"https://api.github.com/users/robert-hh/events{/privacy}","received_events_url":"https://api.github.com/users/robert-hh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/robert-hh/micropython","description":"MicroPython - a lean and efficient Python implementation for microcontrollers and constrained systems","fork":true,"url":"https://api.github.com/repos/robert-hh/micropython","forks_url":"https://api.github.com/repos/robert-hh/micropython/forks","keys_url":"https://api.github.com/repos/robert-hh/micropython/keys{/key_id}","collaborators_url":"https://api.github.com/repos/robert-hh/micropython/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/robert-hh/micropython/teams","hooks_url":"https://api.github.com/repos/robert-hh/micropython/hooks","issue_events_url":"https://api.github.com/repos/robert-hh/micropython/issues/events{/number}","events_url":"https://api.github.com/repos/robert-hh/micropython/events","assignees_url":"https://api.github.com/repos/robert-hh/micropython/assignees{/user}","branches_url":"https://api.github.com/repos/robert-hh/micropython/branches{/branch}","tags_url":"https://api.github.com/repos/robert-hh/micropython/tags","blobs_url":"https://api.github.com/repos/robert-hh/micropython/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/robert-hh/micropython/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/robert-hh/micropython/git/refs{/sha}","trees_url":"https://api.github.com/repos/robert-hh/micropython/git/trees{/sha}","statuses_url":"https://api.github.com/repos/robert-hh/micropython/statuses/{sha}","languages_url":"https://api.github.com/repos/robert-hh/micropython/languages","stargazers_url":"https://api.github.com/repos/robert-hh/micropython/stargazers","contributors_url":"https://api.github.com/repos/robert-hh/micropython/contributors","subscribers_url":"https://api.github.com/repos/robert-hh/micropython/subscribers","subscription_url":"https://api.github.com/repos/robert-hh/micropython/subscription","commits_url":"https://api.github.com/repos/robert-hh/micropython/commits{/sha}","git_commits_url":"https://api.github.com/repos/robert-hh/micropython/git/commits{/sha}","comments_url":"https://api.github.com/repos/robert-hh/micropython/comments{/number}","issue_comment_url":"https://api.github.com/repos/robert-hh/micropython/issues/comments{/number}","contents_url":"https://api.github.com/repos/robert-hh/micropython/contents/{+path}","compare_url":"https://api.github.com/repos/robert-hh/micropython/compare/{base}...{head}","merges_url":"https://api.github.com/repos/robert-hh/micropython/merges","archive_url":"https://api.github.com/repos/robert-hh/micropython/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/robert-hh/micropython/downloads","issues_url":"https://api.github.com/repos/robert-hh/micropython/issues{/number}","pulls_url":"https://api.github.com/repos/robert-hh/micropython/pulls{/number}","milestones_url":"https://api.github.com/repos/robert-hh/micropython/milestones{/number}","notifications_url":"https://api.github.com/repos/robert-hh/micropython/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/robert-hh/micropython/labels{/name}","releases_url":"https://api.github.com/repos/robert-hh/micropython/releases{/id}","deployments_url":"https://api.github.com/repos/robert-hh/micropython/deployments","created_at":"2016-05-25T05:38:15Z","updated_at":"2016-05-25T05:38:28Z","pushed_at":"2016-05-25T16:13:27Z","git_url":"git://github.com/robert-hh/micropython.git","ssh_url":"git@github.com:robert-hh/micropython.git","clone_url":"https://github.com/robert-hh/micropython.git","svn_url":"https://github.com/robert-hh/micropython","homepage":"","size":25992,"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":"micropython:master","ref":"master","sha":"c76acd8c233f436204bf87f1430e7da1ea6baf8c","user":{"login":"micropython","id":6298560,"avatar_url":"https://avatars.githubusercontent.com/u/6298560?v=3","gravatar_id":"","url":"https://api.github.com/users/micropython","html_url":"https://github.com/micropython","followers_url":"https://api.github.com/users/micropython/followers","following_url":"https://api.github.com/users/micropython/following{/other_user}","gists_url":"https://api.github.com/users/micropython/gists{/gist_id}","starred_url":"https://api.github.com/users/micropython/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micropython/subscriptions","organizations_url":"https://api.github.com/users/micropython/orgs","repos_url":"https://api.github.com/users/micropython/repos","events_url":"https://api.github.com/users/micropython/events{/privacy}","received_events_url":"https://api.github.com/users/micropython/received_events","type":"Organization","site_admin":false},"repo":{"id":15337142,"name":"micropython","full_name":"micropython/micropython","owner":{"login":"micropython","id":6298560,"avatar_url":"https://avatars.githubusercontent.com/u/6298560?v=3","gravatar_id":"","url":"https://api.github.com/users/micropython","html_url":"https://github.com/micropython","followers_url":"https://api.github.com/users/micropython/followers","following_url":"https://api.github.com/users/micropython/following{/other_user}","gists_url":"https://api.github.com/users/micropython/gists{/gist_id}","starred_url":"https://api.github.com/users/micropython/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micropython/subscriptions","organizations_url":"https://api.github.com/users/micropython/orgs","repos_url":"https://api.github.com/users/micropython/repos","events_url":"https://api.github.com/users/micropython/events{/privacy}","received_events_url":"https://api.github.com/users/micropython/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/micropython/micropython","description":"MicroPython - a lean and efficient Python implementation for microcontrollers and constrained systems","fork":false,"url":"https://api.github.com/repos/micropython/micropython","forks_url":"https://api.github.com/repos/micropython/micropython/forks","keys_url":"https://api.github.com/repos/micropython/micropython/keys{/key_id}","collaborators_url":"https://api.github.com/repos/micropython/micropython/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/micropython/micropython/teams","hooks_url":"https://api.github.com/repos/micropython/micropython/hooks","issue_events_url":"https://api.github.com/repos/micropython/micropython/issues/events{/number}","events_url":"https://api.github.com/repos/micropython/micropython/events","assignees_url":"https://api.github.com/repos/micropython/micropython/assignees{/user}","branches_url":"https://api.github.com/repos/micropython/micropython/branches{/branch}","tags_url":"https://api.github.com/repos/micropython/micropython/tags","blobs_url":"https://api.github.com/repos/micropython/micropython/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/micropython/micropython/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/micropython/micropython/git/refs{/sha}","trees_url":"https://api.github.com/repos/micropython/micropython/git/trees{/sha}","statuses_url":"https://api.github.com/repos/micropython/micropython/statuses/{sha}","languages_url":"https://api.github.com/repos/micropython/micropython/languages","stargazers_url":"https://api.github.com/repos/micropython/micropython/stargazers","contributors_url":"https://api.github.com/repos/micropython/micropython/contributors","subscribers_url":"https://api.github.com/repos/micropython/micropython/subscribers","subscription_url":"https://api.github.com/repos/micropython/micropython/subscription","commits_url":"https://api.github.com/repos/micropython/micropython/commits{/sha}","git_commits_url":"https://api.github.com/repos/micropython/micropython/git/commits{/sha}","comments_url":"https://api.github.com/repos/micropython/micropython/comments{/number}","issue_comment_url":"https://api.github.com/repos/micropython/micropython/issues/comments{/number}","contents_url":"https://api.github.com/repos/micropython/micropython/contents/{+path}","compare_url":"https://api.github.com/repos/micropython/micropython/compare/{base}...{head}","merges_url":"https://api.github.com/repos/micropython/micropython/merges","archive_url":"https://api.github.com/repos/micropython/micropython/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/micropython/micropython/downloads","issues_url":"https://api.github.com/repos/micropython/micropython/issues{/number}","pulls_url":"https://api.github.com/repos/micropython/micropython/pulls{/number}","milestones_url":"https://api.github.com/repos/micropython/micropython/milestones{/number}","notifications_url":"https://api.github.com/repos/micropython/micropython/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/micropython/micropython/labels{/name}","releases_url":"https://api.github.com/repos/micropython/micropython/releases{/id}","deployments_url":"https://api.github.com/repos/micropython/micropython/deployments","created_at":"2013-12-20T11:47:07Z","updated_at":"2016-05-25T13:28:40Z","pushed_at":"2016-05-25T16:15:07Z","git_url":"git://github.com/micropython/micropython.git","ssh_url":"git@github.com:micropython/micropython.git","clone_url":"https://github.com/micropython/micropython.git","svn_url":"https://github.com/micropython/micropython","homepage":"","size":63839,"stargazers_count":3232,"watchers_count":3232,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":644,"mirror_url":null,"open_issues_count":250,"forks":644,"open_issues":250,"watchers":3232,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/micropython/micropython/pulls/2110"},"html":{"href":"https://github.com/micropython/micropython/pull/2110"},"issue":{"href":"https://api.github.com/repos/micropython/micropython/issues/2110"},"comments":{"href":"https://api.github.com/repos/micropython/micropython/issues/2110/comments"},"review_comments":{"href":"https://api.github.com/repos/micropython/micropython/pulls/2110/comments"},"review_comment":{"href":"https://api.github.com/repos/micropython/micropython/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/micropython/micropython/pulls/2110/commits"},"statuses":{"href":"https://api.github.com/repos/micropython/micropython/statuses/8378dd8dcf623b5e2c178f5f00a92b3bc1039139"}}}}
{"actor":{"display_login":"pfalcon"}}