Skip to content
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

Using '~' in the binarypath argument doesn't work correctly. #28

Closed
shanep2300 opened this issue Feb 14, 2017 · 5 comments
Closed

Using '~' in the binarypath argument doesn't work correctly. #28

shanep2300 opened this issue Feb 14, 2017 · 5 comments

Comments

@shanep2300
Copy link

shanep2300 commented Feb 14, 2017

Trying to make the path point inside the project folder so I try to use:
'~/binaries/BrowserStackLocal.exe'

The test fails and says there is not such directory found in:
'C:/Users//Documents//~/binaries/BrowserStackLocal.exe'

Using version 1.3.0 on Windows 7.

@pulkitsharma07
Copy link
Contributor

Hi, node has issues using ~ in paths. Have a look here nodejs/node#684.
As mentioned you can use os.homedir().

@shanep2300
Copy link
Author

shanep2300 commented Feb 15, 2017

Hmm, I'm getting the same issue where it adds the home directory correctly but os.homedir() is still found inside the path: Error: ENOENT: no such file or directory, unlink 'C:\Users\<user>\Documents\<project>\os.homedir()\binaries\BrowserStackLocal.exe'

Here it is with the ~. Error: ENOENT: no such file or directory, unlink 'C:\Users\<user>\Documents\<project>\~binaries\BrowserStackLocal.exe'. Taking out the / before binaries from op, fixed the extra / showing up in the path. But the ~ is included just like os.homedir() is.

@pulkitsharma07
Copy link
Contributor

pulkitsharma07 commented Feb 15, 2017

it seems like you are passing os.homedir() inside the path, you need to call that method and add the value it returns inside your path. I hope this is clear.
This code snippet should help.

 console.log(os.homedir());
 var binary_path = os.homedir() + "\\binaries\\BrowserStackLocal.exe";
 console.log(binary_path);

You can run the above code snippet using node to see if it prints the desired information.

@shanep2300
Copy link
Author

Perfect! Thank you very much!

@shanep2300
Copy link
Author

Update fix:

var path = require('path');
'binarypath': path.resolve(process.cwd()) +'/binaries/BrowserStackLocal.exe'

This, gives the working directory as os.homedir() points to C:\, in my instance, which ultimately I wanted to avoid using if test is used on different machines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants