Access to target folder from within Acceleo generation [message #1817628] |
Tue, 26 November 2019 22:57 |
Jad El-khoury Messages: 61 Registered: August 2015 |
Member |
|
|
I am trying to work out if a file exists or not, before I can decide if/how I can generate its content.
I thought I can develop a Java service that checks if the file exists on disk. The problem however is that that file path in the [file someFilePath] block is a relative path. The absolute path depends on the base path which is set in the main generate.java class.
How can I get hold of this base path, so I can work out the complete file path of a file to be generated?
I saw this old post https://www.eclipse.org/forums/index.php/t/513117/, but this does not seem to have this problem.
In my case, the base path can be anything the user specifies, and is not relative to the path of the Eclipse project where the model exists.
[Updated on: Tue, 26 November 2019 22:59] Report message to a moderator
|
|
|
|
Re: Access to target folder from within Acceleo generation [message #1817910 is a reply to message #1817638] |
Tue, 03 December 2019 03:14 |
Jad El-khoury Messages: 61 Registered: August 2015 |
Member |
|
|
Hi,
This question concerns the configuration of the program (Acceleo) that runs the model transformation, and not necessarily related to the model transformation itself. For what it is worth for others facing similar question, I ended up passing the targetFolder as a parameter to the main Acceleo model, by modifying the java method, as such
public Generate(EObject model, File targetFolder,
List<? extends Object> arguments) throws IOException {
//initialize(model, targetFolder, arguments);
initialize(model, targetFolder, List.of(targetFolder.getAbsolutePath()));
}
|
|
|
Powered by
FUDForum. Page generated in 0.02497 seconds