Skip to content
This repository was archived by the owner on Feb 19, 2026. It is now read-only.

Make 'rc.path' absolute#158

Merged
vweevers merged 3 commits intoprebuild:masterfrom
dunkmann00:make-path-abs
Aug 11, 2021
Merged

Make 'rc.path' absolute#158
vweevers merged 3 commits intoprebuild:masterfrom
dunkmann00:make-path-abs

Conversation

@dunkmann00
Copy link
Copy Markdown
Contributor

@dunkmann00 dunkmann00 commented Jun 23, 2021

I went ahead and implemented the suggestion by @vweevers. This will make rc.path an absolute path.

This fixes #157.

@vweevers
Copy link
Copy Markdown
Member

I would prefer to do it here:

prebuild-install/rc.js

Lines 45 to 47 in cca87fb

if (rc.path === true) {
delete rc.path
}

So that we don't modify rc outside of rc. Along the lines of:

rc.path = path.resolve(rc.path === true ? '.' : rc.path || '.')

@vweevers
Copy link
Copy Markdown
Member

Can you update this test accordingly?

t.equal(rc.path, '../some/other/path', 'correct path')
t.equal(rc.path, rc.p, 'path alias')

@dunkmann00
Copy link
Copy Markdown
Contributor Author

I just saw that after I pushed it, I'll take a look!

What should I set as the correct path? Running the tests on Github vs locally will result in a different value for path.

@vweevers
Copy link
Copy Markdown
Member

It's OK to use path.resolve('../some/other/path') in the test as well. Or more precisely (because the test uses a random temporary directory as the working directory): path.resolve(tmp, '../some/other/path'). One way to get that tmp variable is to pass it to the callback here:

cb(result)

I.e. cb(result, tmp)

Comment thread test/rc-test.js Outdated
@vweevers vweevers merged commit 57bcc06 into prebuild:master Aug 11, 2021
@vweevers
Copy link
Copy Markdown
Member

6.1.4. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--path option writing to wrong destination

2 participants