Reputation: 57479
I'm writing a post build event for visual studio project.
I have:
java -jar "$(ProjectDir)..\Tools\closure_compiler.jar"
but it turns out to be after compiled:
"D:\Projects\Source\Proj.Web\..\Tools\closure_compiler.jar"
which is an invalid directory, it just appends the dots. My problem is that I want to go back up 1 directory. The absolute file path is:
"D:\Projects\Source\Tools\closure_compiler.jar"
The full event is:
java -jar "$(ProjectDir)..\Tools\closure_compiler.jar" --js "$(ProjectDir)Scripts\*.debug.js" --js_output_file "$(ProjectDir)Scripts\script-bundle.min.js"
The error is:
Error 24 The command "java -jar "D:\Projects\Xormis\trunk\Source\Xormis.Web\..\Tools\closure_compiler.jar" --js "D:\Projects\Xormis\trunk\Source\Xormis.Web\Scripts\*.debug.js" --js_output_file "D:\Projects\Xormis\trunk\Source\Xormis.Web\Scripts\script-bundle.min.js"" exited with code 1. Xormis.Web
Upvotes: 1
Views: 3440
Reputation: 134571
Here's a possible workaround for this. You just need to convert the relative path to an absolute one. If visual studio can handle regular command prompt commands with command extensions, this may work:
set ProjectDir=$(ProjectDir)
java -jar "%ProjectDir:~0,-9%Tools\closure_compiler.jar"
pushd $(ProjectDir)
cd ..
set ClosureCompiler=%CD%\Tools\closure_compiler.jar
popd
java -jar "%ClosureCompiler%"
You may need to tweak these to fit your needs.
Upvotes: 2
Reputation: 38778
The solution folder is typically one above the project directory, so give this a shot:
$(SolutionDir)\Tools\closure_compiler.jar
If that doesn't work, check out the full list of available macros. Maybe there's something else that'll come close.
Upvotes: 0