-
Notifications
You must be signed in to change notification settings - Fork 110
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
New feature: creating a directory tree #1367
base: horizon
Are you sure you want to change the base?
Conversation
WHOA. What does this do in the browser? |
Nothing -- it's in the filelib module, which isn't made available on CPO. |
if (isISD(tree)) { | ||
RUNTIME.ffi.toArray(RUNTIME.getField(tree, "keys-list").app()).forEach(function(sub) { | ||
var kid = RUNTIME.getColonField(tree, "get-value").full_meth(tree, sub); | ||
makeDirs(baseDir + "/" + sub, kid); |
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.
Should we be more judicious about using path.join
or whatever the blessed path
library thing is? I know we have other windows issues but that's probably the right thing to do.
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.
I can't tell, tbh: https://nodejs.org/docs/latest/api/fs.html#fsmkdirpath-options-callback gives an example of calling mkdir
on "/"
even on Windows...
if (!fs.existsSync(baseDir)) fs.mkdirSync(baseDir); | ||
if (isISD(tree)) { | ||
RUNTIME.ffi.toArray(RUNTIME.getField(tree, "keys-list").app()).forEach(function(sub) { | ||
var kid = RUNTIME.getColonField(tree, "get-value").full_meth(tree, sub); |
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.
Maybe worth a comment that this won't stack capture because of what we know about immutable-string-dict
's get-value
method being flat? Like if this was changed to a generic .get-value
dictionary interface, this wouldn't be safe.
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.
Yeah, possibly
Implements a new method
create-dir-tree
, which is likemkdir -p
but enhanced. Given a base directory, and a string-dict of string-dicts of ..., where the innermost string-dicts' values are irrelevant, build a directory tree whose nesting structure corresponds to the keys of the string-dicts.