|
|
|
Re: Absolute file path [message #717558 is a reply to message #717551] |
Sun, 21 August 2011 10:20 |
|
Hi,
why is using the resource plugin a problem???
can you elaborate a bit how you execute your stuff???
how do you get the xtext models?
Why don't you simply ask the models for a file string?
sure you may have to wrap this into a new File(….) to
get an absolute path. but this should be no problem.
public static void main(String[] args) throws IOException {
Injector injector = new
MyDslStandaloneSetup().createInjectorAndDoEMFRegistration();
ResourceSet rs = injector.getInstance(ResourceSet.class);
URI uri = URI.createURI("../org.xtext.example.mydsl/src/Test.mydsl");
Resource r = rs.getResource(uri, true);
Model m = (Model) r.getContents().get(0);
String absolutePath = new
File(m.eResource().getURI().toFileString()).getCanonicalPath();
System.out.println(absolutePath);
}
BTW. this is an EMF question and not an Xtext question.
~Christian
On 2011-08-21 09:28:50 +0000, Olaf said:
> Hi,
>
> thank you, Timo, this will work for me!
>
> But just as a matter of interest: Is there a way to get the absolute
> path without using the resources plugin? Xtext claims that it may be
> used without any eclipse. And there are for sure use cases where you
> need an absolute path.
>
> Olaf
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
Powered by
FUDForum. Page generated in 0.03654 seconds