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

code-runner.cwd support variables #20

Closed
SailorMax opened this issue Sep 15, 2016 · 6 comments
Closed

code-runner.cwd support variables #20

SailorMax opened this issue Sep 15, 2016 · 6 comments

Comments

@SailorMax
Copy link

Can you add support variables like ${fileDirname} for "Set the working directory" setting?
I need exec scripts from local directory.

thank you.

@formulahendry
Copy link
Owner

formulahendry commented Sep 16, 2016

Currently, the cwd will be set as root folder opened in VS code if code-runner.cwd is not set. How about add a config entry to determine to use root folder or folder of current running file?

@SailorMax
Copy link
Author

SailorMax commented Sep 16, 2016

Sample?

Actually I need run script via 2 steps:

  1. cwd [directory of file]
  2. php -f [filename without directory]

Currently it has wrong cwd and run script with full path to file.

@formulahendry
Copy link
Owner

any difference bertween filename without directory and full path of file?

@formulahendry
Copy link
Owner

Please install the visx in attached zip file (use VS Code to open the visx to install), and set code-runner.fileDirectoryAsCwd as true in User Settings or Workspace Settings. It will set the cwd as directory of file. Let me know whether it meets with your requirement. 😃

code-runner-0.2.3.zip

@formulahendry
Copy link
Owner

Just ship the v0.2.4, you could have a try. For the filename issue, I did not see the difference between filename without directory and full path of file, so I will not change the behavior.

@SailorMax
Copy link
Author

yes. Script can work via web in chroot directory => in command line we can try to emulate same behavior:

  1. current directory = chrooted directory
  2. path to file = /scripts/update_records.php, where "/" is based on current directory.

But this is little another task. Plus I made required fixes in my script for correct work even with old settings.
Anyway, thanks for modification. It can be useful.

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

No branches or pull requests

2 participants