Variable definitions: FilePath, FileDir
Answered
Is there any where in IntelliJ help where it defines such things as
$FileDir$
$FilePath$
Thanks,
Ted
Please sign in to leave a comment.
It's a dir and path respectively of the file currently opened in editor or
selected in the project view or commander.
-
Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"
Is there documentation for these in the help system?
There are other variables that I am also curious about.
Thanks,
Ted
This is extremely late but this thread actually shows up nearly first on Google when I searched for this information, so I'll reply here.
The macros don't seem to be documented anywhere (I'd love to be corrected on this), but you can find a list of them by going to File > Tools > External Tools > <Create new tool> and clicking "Insert macro". There's also a preview box showing the current value of the selected macro. Most are self-explanatory, but some (e.g. Prompt) could use more documentation for sure.
This is helpful! Thanks! :)
As an update, I was looking for them and I couldn't quite find them per the instructions above.
I found them by opening settings, navigating to Tools > External Tools, and when creating a new tool, the 3 input boxes under Tool Settings have little plus arrows next to them. Clicking these will display a list of variables you can use. (The same is available when creating a file watcher!)
So is there any easy-to-use documentation about the built in variables/macros today 2022?
Don't say that the current display of simple info in "+" macro window is enough......
BBK_KBB
We are working on adding the info to our documentation. Appreciate the feedback.
csv:
```
variable,description
"$AffectedModuleNames$","The names of modules in the scope, comma-separated"
"$ClipboardContent$","The clipboard content"
"$ColumnNumber$","Column number"
"$ContentRoot$","Content root path the file belongs to"
"$FileDir$","File directory"
"$FileDirName$","File directory name"
"$FileDirPathFromParent$","Path to $FileDir$ from parent directory with the name passed as a parameter"
"$FileDirRelativeToProjectRoot$","File directory relative to the module content root the file belongs to"
"$FileDirRelativeToSourcepath$","File directory relative to the source path root the file belongs to"
"$FileEncoding$","File encoding"
"$FileExt$","File extension"
"$FileName$","File name"
"$FileNameWithoutAllExtensions$","File name without all extensions"
"$FileNameWithoutExtension$","File name without extension"
"$FileParentDir$","File parent directory. Takes an optional parameter (name) to find the parent directory"
"$FilePath$","File path"
"$FilePathRelativeToProjectRoot$","File path relative to the module content root the file belongs to"
"$FilePathRelativeToSourcepath$","File path relative to the source path root the file belongs to"
"$FilePrompt$","Shows a file chooser dialog"
"$FileRelativeDir$","File directory relative to the project file"
"$FileRelativePath$","File path relative to the project file"
"$IsMake$","Boolean value according to the performed compilation: true for make, false for force recompile"
"$JDKPath$","JDK path"
"$LineNumber$","Line number"
"$ModuleFileDir$","The directory of the module file"
"$ModuleFilePath$","The path to the module file"
"$ModuleName$","The name of the module file without extension"
"$ModuleSdkPath$","Project interpreter path"
"$ModuleSourcePath$","Module source path"
"$OSName$","The name of the operating system in lower case"
"$OSUser$","The name of the operating system user"
"$Password$","Displays a password input dialog"
"$ProjectFileDir$","The directory of the project file"
"$ProjectName$","The name of the project file without extension"
"$Projectpath$","Project source path"
"$Prompt$","Displays a string input dialog"
"$PyInterpreterDirectory$","The directory containing the Python interpreter selected for the project"
"$SelectedText$","Text selected in the editor"
"$SelectionEndColumn$","Selected text end column number"
"$SelectionEndLine$","Selected text end line number"
"$SelectionStartColumn$","Selected text start column number"
"$SelectionStartLine$","Selected text start line number"
"$Sourcepath$","Project source path"
"$SourcepathEntry$","Entry in the source path the element belongs to"
"$TempDir$","The directory for temporary files"
"$UnixSeparators$","Takes a parameter and converts separators to '/'. Ex. $UnixSeparators\foo\bar\)$ == /foo/bar/"
```
Markdown:
```
|variable|description |
|--------|-----------------------------|
|\$AffectedModuleNames\$|The names of modules in the scope, comma-separated|
|\$ClipboardContent\$|The clipboard content |
|\$ColumnNumber\$|Column number |
|\$ContentRoot\$|Content root path the file belongs to|
|\$FileDir\$|File directory |
|\$FileDirName\$|File directory name |
|\$FileDirPathFromParent\$|Path to \$FileDir\$ from parent directory with the name passed as a parameter|
|\$FileDirRelativeToProjectRoot\$|File directory relative to the module content root the file belongs to|
|\$FileDirRelativeToSourcepath\$|File directory relative to the source path root the file belongs to|
|\$FileEncoding\$|File encoding |
|\$FileExt\$|File extension |
|\$FileName\$|File name |
|\$FileNameWithoutAllExtensions\$|File name without all extensions|
|\$FileNameWithoutExtension\$|File name without extension |
|\$FileParentDir\$|File parent directory. Takes an optional parameter (name) to find the parent directory|
|\$FilePath\$|File path |
|\$FilePathRelativeToProjectRoot\$|File path relative to the module content root the file belongs to|
|\$FilePathRelativeToSourcepath\$|File path relative to the source path root the file belongs to|
|\$FilePrompt\$|Shows a file chooser dialog |
|\$FileRelativeDir\$|File directory relative to the project file|
|\$FileRelativePath\$|File path relative to the project file|
|\$IsMake\$|Boolean value according to the performed compilation: true for make, false for force recompile|
|\$JDKPath\$|JDK path |
|\$LineNumber\$|Line number |
|\$ModuleFileDir\$|The directory of the module file|
|\$ModuleFilePath\$|The path to the module file |
|\$ModuleName\$|The name of the module file without extension|
|\$ModuleSdkPath\$|Project interpreter path |
|\$ModuleSourcePath\$|Module source path |
|\$OSName\$|The name of the operating system in lower case|
|\$OSUser\$|The name of the operating system user|
|\$Password\$|Displays a password input dialog|
|\$ProjectFileDir\$|The directory of the project file|
|\$ProjectName\$|The name of the project file without extension|
|\$Projectpath\$|Project source path |
|\$Prompt\$|Displays a string input dialog|
|\$PyInterpreterDirectory\$|The directory containing the Python interpreter selected for the project|
|\$SelectedText\$|Text selected in the editor |
|\$SelectionEndColumn\$|Selected text end column number|
|\$SelectionEndLine\$|Selected text end line number|
|\$SelectionStartColumn\$|Selected text start column number|
|\$SelectionStartLine\$|Selected text start line number|
|\$Sourcepath\$|Project source path |
|\$SourcepathEntry\$|Entry in the source path the element belongs to|
|\$TempDir\$|The directory for temporary files|
|\$UnixSeparators\$|Takes a parameter and converts separators to '/'. Ex. \$UnixSeparators\foo\bar\)\$ == /foo/bar/|
```