-
Notifications
You must be signed in to change notification settings - Fork 302
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
fix: file globing #785
fix: file globing #785
Conversation
…o fix/cli-file-glob
log.debug(`Copy ${file} file to ${outDir} directory`); | ||
await cp( | ||
file, | ||
`${outDir}/${ | ||
platform !== "osx" ? "package.nw" : "nwjs.app/Contents/Resources/app.nw" | ||
}/${basename(file)}`, | ||
}/${file.split(sep).splice(2).join(sep)}`, |
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.
This line causes problem on windows. "/"
instead of sep
should be used here (The rest of the path is already using "/"
). file
comes from glob expanded srcDir
, which always use "/"
. split(sep)
split nothing on windows causing the subdirectory to disappear.
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.
Can you open a bug report referencing this line or a pull request to fix this?
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'm working on getting Windows builds working in #795. I realise I need to use path.resolve
which would remove the need for sep
.
Fixes: #
Description
Undocumented bug discovered through Stack Overflow.
node-glob
and yargs file glob seem to work differently. For now, one can tweak the glob pattern for CLI to match the required files and directories. Anoptions.cli
flag is set totrue
on each CLI run. This preventsnode-glob
from doing twice the work and erroring out with the error message as mentioned in the Stack Overflow post.With module usage, the copied file
subdir/file.js
would be copied asoutDir/package.nw/file.js
. This is now fixed and is copied asoutDir/package.nw/subdir/file.js
.