maybe you can use the Interface org.eclipse.xtext.generator.IFileSystemAccessExtension2
. the passed IFileSystemAccess may implement this interface too.
Xtext get the absolute path of the generated files
题
I want to access the file generated by Xtext to compile it automatically. So I need its absolute path. It's enough to get the absolute path of the current project at run-time. Any idea how I can get it?
I am working inside the "MyDslGenerator" Class. I tried to get it from the "resource" in
override void doGenerate(Resource resource, IFileSystemAccess fsa)
but couldn't find it.
Help is highly appreciated.
I ended up using this code:
var uri = (fsa as IFileSystemAccessExtension2).getURI(fileName)
解决方案
不隶属于 StackOverflow