use enviroment variables instead of "Path Variables" in paths in intellijidea - intellij-idea

I am already aware of Path Variable but is there's a way to use environment variables in paths instead of path variables in intellijidea, I have tried using the syntax ${VAR} but it doesn't work, and tried also the Path variable syntax $VAR$ but it works with Path Variables only.

Currently there is no such possibility in IntelliJ IDEA.

After Peter Gromov answer, I have decided to create a simple plugin for this.
"Environment Variables in Path Variables" plugin:
github repo: https://github.com/mohamedkomalo/env-vars-in-path-vars
on jetbrains: https://plugins.jetbrains.com/plugin/8063

Related

Problem with using environment variables in Intellij

It is not possible to use regular env variables references in intellij:
Approach:
-Dvar=${ENV_VAR}
simply doesn't work when environment variable was added in the same run_configuration.
env variables
Anyway to resolve the issue?
Found an solution among responses for other/similar question.
Turned out that Intellij is using different notation when using env variables defined in the same run configuration.
For env variables defined in the system you need to use:
-Dvar=${ENV_VAR}
but for env variables created in the same run configuration, you need to use:
-Dvar=$ENV_VAR$
Post that helped me to find a solution is here: https://stackoverflow.com/a/28280595/3484423.

IntelliJ - easy way to add all environment variables and PATH locations to the run config

We can add Environment variables one by one environment variables manually using UI screen. But is there a easy way to load/add all PATH locations or Environment variables mentioned in .bashrc file.
Yes all you need to do is paste them in the Run/Debug Configuration screen before this window opens. Each env variable must be deliminated by a semicolon ; too.
Example:
PATH=/mypath; JAVA_HOME=/anotherpath;
Intellij Guide:
Edit existing Run/Debug Configs
Paste them here

Using path variable in intellij maven run configuration

I'm trying to set up and share maven run configurations in my team and I have this problem. Every team member has different project path. I would like to use path variable in order to define working directory for maven run config. Looks like IntelliJ doesn't evaluate this path variable. Any ideas how to solve this problem?
Error:"the working directory '$MODULE_DIR$' does not exist". "$MODULE_DIR$" is default IntelliJ path variable.
You do not need to do anything. Just use the default value which is a real path to the module inside your project. IDE will automatically use the Path Variable for the Run Configuration xml file.
Note that path variables can not be used in the UI for specifying paths. IDE automatically substitutes them when you use real paths.

IntelliJ environment variable pointing to IDE config directory

In IntelliJ there are pre-defined env variables one can use like:
$MODULE_DIR$ - current module directory
$PROJECT_DIR$ - project root directory (where .idea folder sits)
$APPLICATION_HOME_DIR$ - installation directory
Is there a variable I can use that points to the configuration folder of IntelliJ - e.g:
C:\Users\<username>\.IdeaIC<version>\config
For anyone looking for this, the variable is called: APPLICATION_CONFIG_DIR
It looks like there is not a document or web page where JetBrains would list all the IDE environmental variables used / declared or available. After a purely random and lucky search I found scratch files are saved under APPLICATION_CONFIG_DIR.

Variable that refers to the project directory in Qt Creator?

I'm working on a cross-platform Qt application and the paths are different on Mac OS X and Windows. Since the project is on an external hard-drive, the drive letter also occasionally changes on Windows.
For that reason, I would like to refer to the project directory using a variable, preferably a built-in one. In particular, is there such a variable usable in:
The .pro file?
The build settings (in the Projects tab)?
To complete, #Bill's answer, the way to refer to the source path in the Build Settings is to use %{sourceDir}.
%{buildDir} is also available.
Since I struggled a bit to find it, I'm adding it here.
In addition to %{sourceDir} and %{buildDir}, you could use %{CurrentDocument:Path}, %{CurrentDocument:FilePath} and %{CurrentProject:Path} to refer to specific files and folders in the project directory.
The built-in _PRO_FILE_PWD_ variable contains the path to the directory containing the project file in use. That variable may be useful for you.
There are problems with $$_PRO_FILE_PWD_ on windows, because it contains forward slash allways. You need to fix slash using shell_path.
$$shell_path($$_PRO_FILE_PWD_)