$FilePath$ with forward slashes
Answered
I need the $FilePath$ variable to return the path to the current file with forward slashes instead of backslashes ( I am on Windows). Is there any way to achieve that?
Please sign in to leave a comment.
Hi Dbambusek,
Could you please describe your case in more detail? Where do you need it returned and to what purpose?
The $/FilePathRelativeToProjectRoot$ did partly the job for me. However I am looking for a universal macro, that would give me the path to the currently opened file in editor with forward slashes on both Windows and Unix.
$/FilePathRelativeToProjectRoot$ exists only for Windows
$FilePath$ gives path with backward slashes on Windows and with forward slashes on Unix
So I need a macro that returns e.g. 'myproject/src/assets/css/current_file.css' inependently on the running OS
There is no such predefined macro in IntelliJ IDEA, I'm afraid, but you can always create your own custom one and embed it into the IDE via a plugin.
See this documentation article and this post for details on how to achieve that.
Use variable this way - $UnixSeparators($FilePathRelativeToProjectRoot$)$