Run/Debug Configuration and Environment Vars

Answered

Is it possible to use env vars as part of the paths set for directory, output directory, working directory, etc in Run/Debug Configuration?  My projects are on OneDrive and the paths are different on my home and work computers.  Need this so I don't have to keep going in and setting the paths every time.

The system has the env var OneDrive and I tried setting this but could not get it to work.  

0
1 comment

Hello,

At the moment there is no way to specify paths as variables, but I propose a slightly different way of control.

Most often, the paths lead to the root directory of the project itself, so you can do the following:

  1. Create a new configuration, set paths to directories.
  2. Enable checkbox "Store as project file".
  3. Add the ./idea/runConfigurations directory to Git and upload to your remote storage like OneDrive.

The next time you take an up-to-date copy of the project from a remote repository, e.g., on a working device, the paths to the directories will be automatically set based on where the project is located. Your project directory may be /Users/daniil.maslov/go/src/go-plugin on macOS, but when you open this project on Windows, it'll be different: C:\Users\daniil.maslov\go\src\github.com\software\go-configuration-example.

I hope it helps.

0

Please sign in to leave a comment.