Closed hzlmn closed 7 years ago
In my mind, that's okay lol. Imo no one should ever be using ./
to precede their paths. It's totally redundant.
But I suppose I can/should allow it, despite my personal opinions 😆
@lukeed It's fine, but how I can specify path like ../dist
without adding path?
If this is your app structure:
|- \project
|- \app
|- flyfile.js
|- \dist
And you want to send files to dist
, then using ../dist
will work just fine.
If, however, this is your structure:
|- \project
|- flyfile.js
|- \app
|- \dist
Then all you need to specify is dist
. Although, ./dist
will work too. Just tried it.
Oh, right. it's only broken when in second structure i specify path like ./app
for this.source
What's the output when you do that?
output is not produced as expected
is too vague to work with 😎
my bad :smile: it's empty folder but when without ./
in the beginning, it copy files as expected.
Hmm. Is that on Windows?
Nope. Linux (Ubuntu 14 LTS)
same thing. btw seems like files matched correctly
[ './app/ui-kit/fonts/gl-font/glfont.eot',
'./app/ui-kit/fonts/gl-font/glfont.svg',
'./app/ui-kit/fonts/gl-font/glfont.ttf',
'./app/ui-kit/fonts/gl-font/glfont.woff',
'./app/ui-kit/fonts/gl-font/selection.json' ]
Here is output for files
Ok, then go to target
and log out trims
and each o.dir
final value (after the for-loop).
trims [ './app/ui-kit/fonts' ]
dir for glfont.eot /home/olehkuchuk/Projects/gl-uikit/app/ui-kit/fonts/gl-font
dir for glfont.svg /home/olehkuchuk/Projects/gl-uikit/app/ui-kit/fonts/gl-font
dir for glfont.ttf /home/olehkuchuk/Projects/gl-uikit/app/ui-kit/fonts/gl-font
dir for glfont.woff /home/olehkuchuk/Projects/gl-uikit/app/ui-kit/fonts/gl-font
dir for selection.json /home/olehkuchuk/Projects/gl-uikit/app/ui-kit/fonts/gl-font
Seems like target dir equals sourcing.
And here is output without ./
trims [ 'app/ui-kit/fonts' ]
dir for glfont.eot /home/olehkuchuk/Projects/gl-uikit/./dist/gl-uikit/fonts/gl-font
dir for glfont.svg /home/olehkuchuk/Projects/gl-uikit/./dist/gl-uikit/fonts/gl-font
dir for glfont.ttf /home/olehkuchuk/Projects/gl-uikit/./dist/gl-uikit/fonts/gl-font
dir for glfont.woff /home/olehkuchuk/Projects/gl-uikit/./dist/gl-uikit/fonts/gl-font
dir for selection.json /home/olehkuchuk/Projects/gl-uikit/./dist/gl-uikit/fonts/gl-font
Mm, I got it. When you replace it here
when path with ./
replacement not working
dir: /home/olehkuchuk/Projects/gl-uikit/app/ui-kit/fonts/gl-font, trim: ./app/ui-kit/fonts, replacement: ./dist/gl-uikit/fonts
dir: /home/olehkuchuk/Projects/gl-uikit/app/ui-kit/fonts/gl-font, trim: ./app/ui-kit/fonts, replacement: ./dist/gl-uikit/fonts
dir: /home/olehkuchuk/Projects/gl-uikit/app/ui-kit/fonts/gl-font, trim: ./app/ui-kit/fonts, replacement: ./dist/gl-uikit/fonts
dir: /home/olehkuchuk/Projects/gl-uikit/app/ui-kit/fonts/gl-font, trim: ./app/ui-kit/fonts, replacement: ./dist/gl-uikit/fonts
dir: /home/olehkuchuk/Projects/gl-uikit/app/ui-kit/fonts/gl-font, trim: ./app/ui-kit/fonts, replacement: ./dist/gl-uikit/fonts
So you placed console.log('dir for ', o.base, o.dir) here?
yes
Sorry, my bad. Don't replace it. This is what you should have:
for (const t of trims) {
o.dir = o.dir.replace(t, d);
}
console.log(`dir for ${o.base}: `, o.dir);
Sorry, my bad. Don't replace it
What do you mean?
Haha, does your current code look like this?
for (const t of trims) {
o.dir = o.dir.replace(t, d);
}
console.log(`dir for ${o.base}: `, o.dir);
Exactly
What I actually mean is that when
you replace o.dir
here
for (const t of trims) {
console.log(`dir: ${o.dir}, trim: ${t}, replacement: ${d}`)
o.dir = o.dir.replace(t, d); // here is replacement is broken when path contains './'
}
Here is output of log
dir: /home/olehkuchuk/Projects/gl-uikit/app/ui-kit/fonts/gl-font, trim: ./app/ui-kit/fonts, replacement: ./dist/gl-uikit/fonts
dir: /home/olehkuchuk/Projects/gl-uikit/app/ui-kit/fonts/gl-font, trim: ./app/ui-kit/fonts, replacement: ./dist/gl-uikit/fonts
dir: /home/olehkuchuk/Projects/gl-uikit/app/ui-kit/fonts/gl-font, trim: ./app/ui-kit/fonts, replacement: ./dist/gl-uikit/fonts
dir: /home/olehkuchuk/Projects/gl-uikit/app/ui-kit/fonts/gl-font, trim: ./app/ui-kit/fonts, replacement: ./dist/gl-uikit/fonts
dir: /home/olehkuchuk/Projects/gl-uikit/app/ui-kit/fonts/gl-font, trim: ./app/ui-kit/fonts, replacement: ./dist/gl-uikit/fonts
@hzlmn Ah. That isn't very helpful. Please try what I pasted above & send me the output.
Thanks
Ok, fixed. Please checkout the new commit & verify that it works on your end.
Sorry for all the back 'n forth!
it works fine, but with
output is not produced as expected