-
Notifications
You must be signed in to change notification settings - Fork 34
Merge mkdir and mkdirRecursive #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,6 @@ module Node.FS.Async | |
, unlink | ||
, rmdir | ||
, mkdir | ||
, mkdirRecursive | ||
, mkdir' | ||
, readdir | ||
, utimes | ||
|
@@ -201,34 +200,16 @@ rmdir file cb = mkEffect $ \_ -> runFn2 | |
mkdir :: FilePath | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we're already going to break this, it may be better to provide an options record: mkdir :: { dirname :: Filepath, recursive :: Boolean, perms :: Perms } -> Callback Unit -> Effect Unit to avoid boolean blindness. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure we need this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed on the 0.15 call, we should just match the explicit API provided via Node: https://nodejs.org/api/fs.html#fsmkdirpath-options-callback mkdir :: FilePath -> { recursive :: Boolean, mode :: Perms } -> Callback Unit -> Effect Unit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! The code was already using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm personally fine with the primed option. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. Can I get an approval then? |
||
-> Callback Unit | ||
-> Effect Unit | ||
mkdir path = mkdir' path { recursive: false, mode: mkPerms all all all } | ||
|
||
mkdir path = mkdir' path (mkPerms all all all) | ||
|
||
-- | Makes a new directory and any directories that don't exist | ||
-- | in the path. Similar to `mkdir -p`. | ||
mkdirRecursive :: FilePath | ||
-> Callback Unit | ||
-> Effect Unit | ||
|
||
mkdirRecursive path = mkdirRecursive' path (mkPerms all all all) | ||
|
||
-- | Makes a new directory (and any directories that don't exist | ||
-- | in the path) with the specified permissions. | ||
mkdirRecursive' | ||
-- | Makes a new directory with the specified permissions. | ||
mkdir' | ||
:: FilePath | ||
-> Perms | ||
-> { recursive :: Boolean, mode :: Perms } | ||
-> Callback Unit | ||
-> Effect Unit | ||
mkdirRecursive' file perms cb = mkEffect $ \_ -> runFn3 | ||
mkdirImpl file { recursive: true, mode: permsToString perms } (handleCallback cb) | ||
|
||
-- | Makes a new directory with the specified permissions. | ||
mkdir' :: FilePath | ||
-> Perms | ||
-> Callback Unit | ||
-> Effect Unit | ||
mkdir' file perms cb = mkEffect $ \_ -> runFn3 | ||
mkdirImpl file { recursive: false, mode: permsToString perms } (handleCallback cb) | ||
mkdir' file { recursive, mode: perms } cb = mkEffect $ \_ -> runFn3 | ||
mkdirImpl file { recursive, mode: permsToString perms } (handleCallback cb) | ||
|
||
-- | Reads the contents of a directory. | ||
readdir :: FilePath | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... This isn't entirely correct as it was
mkdir'
that was updated now. I'll need to submit a new PR.