Project Directory Variable

Answered

Is there a variable I can use for project directory when inputting custom scripts and it asks for the Working Directory?

7 comments
Comment actions Permalink

I just noticed by looking at the configuration xml file that Pycharm replaced my project path with $PROJECT_DIR$. But i can't use it directly on my script path...

I mean the feature is there, but you don't let us use it...

2
Comment actions Permalink

When you create a file watcher configuration, you have a number of variables to use. For example you can set the working directory via $FileDir$.

I think we are just looking to use those type of variables in the run configurations. Specifically I'd like to have a default ruby configuration with my desired options that would use the project path when I create an instance of that configuration.

2
Comment actions Permalink

@Olga: Thanks for the link, but it's to a long page so it's hard to see what you're referring to specifically.

I believe what's actually being requested here is a way to access JetBrains settings variables, e.g. the project directory. This would include system environment variables, e.g. $HOME, but they're not what's being asked for here specifically.

Personally, right now, in PyCharm, I'm setting Run→Edit Configurations…→[my project]→Logs→Add→Log File Location, and it's asking me to pick a path. There are handy buttons for picking the project root path, but that path is what ends up getting saved to the configuration file. Therefore, if the project moves, the configuration will break. It would therefore be nice if we could enter something like '${project_dir}/foo.log', so everything keeps working, even if we move the project.

While I don't think it's the best implementation, Eclipse offers this funtionality: https://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.stardust.docs.dev%2Fhtml%2Fhandbooks%2Fmodelling%2Fmodel-variables.html It's something I miss in PyCharm.

2
Comment actions Permalink

Up ! I'm also looking for project variables i could use in my run configurations settings like Visual Studio has : $(ProjectDir) or $(OutDir)

0
Comment actions Permalink

Please check if setting environment variables is what you need:

https://www.jetbrains.com/help/ruby/2017.1/run-debug-configuration-ruby.html

0
Comment actions Permalink

I am also looking for a variable where I can use it to dynamically reference the project root directory.  I would like to use it in run configuration and also in many other places, like Settings -> Appearance & Behavior -> Scopes.

0
Comment actions Permalink

We have a similar request regarding more variables so it'd be great if your could add your vote there:

https://youtrack.jetbrains.com/issue/IDEA-122504

0

Please sign in to leave a comment.