aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-04-01 09:36:43 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-04-01 09:38:12 -0700
commit04903aab84d94db3f5c0534e9eae0a6cdc6816ba (patch)
tree7c558483e5962e2c5a0bad10c7af50e27c9e23ef /src
parent927f26f3729fc5279e0cb4481fb0c484ec6255c0 (diff)
fix mkdir on a path ending in a slash; fixes #2263 and #2258
Diffstat (limited to 'src')
-rw-r--r--src/library.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/library.js b/src/library.js
index 881fa54b..e0d8c5b7 100644
--- a/src/library.js
+++ b/src/library.js
@@ -325,6 +325,9 @@ LibraryManager.library = {
// int mkdir(const char *path, mode_t mode);
// http://pubs.opengroup.org/onlinepubs/7908799/xsh/mkdir.html
path = Pointer_stringify(path);
+ // remove a trailing slash, if one - /a/b/ has basename of '', but
+ // we want to create b in the context of this function
+ if (path[path.length-1] === '/') path = path.substr(0, path.length-1);
try {
FS.mkdir(path, mode, 0);
return 0;