Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Setting an absolute path for the File block
Setting an absolute path for the File block [message #1767957] Wed, 12 July 2017 11:53 Go to next message
Jad El-khoury is currently offline Jad El-khouryFriend
Messages: 61
Registered: August 2015
Member
For the File block, is there a way to specify an absolute path for the file being generated?
It seems that the paramter provided to the file block is always interpreted relative to the model file from which the code is being generated.

Alterantively, can I somehow set the reference path (from which all generated files are to be generated) to be other than the project within which the model is?
Re: Setting an absolute path for the File block [message #1768060 is a reply to message #1767957] Thu, 13 July 2017 10:56 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi,

The "root" folder Acceleo uses for the generation is the "Target" field of the Acceleo launch configuration.
If you're using an Acceleo UI Launcher, that "target" can be configured in the new Acceleo UI Launcher wizard.
If you already have your UI project and thus can't use the wizard, you'll find the line to change in the GenerateAction.java file, in the "run" operation (by default:
IContainer target = model.getProject().getFolder("src-gen");

By default, UI launcher projects take an IContainer, so it must be located in the workspace... but that is not a requirement for Acceleo and you can change the GenerateAll class to take an absolute file location instead.
You could also look at the generated java class beside your "main" module : the "targetFolder" field is the root of the relative paths for generated files.

Laurent Goubet
Obeo
Re: Setting an absolute path for the File block [message #1768297 is a reply to message #1768060] Mon, 17 July 2017 07:54 Go to previous message
Jad El-khoury is currently offline Jad El-khouryFriend
Messages: 61
Registered: August 2015
Member
Thanks Laurent!

I was trying to solve the problem within the acceleo templates. but, it seems more intuitive to fix the UI launcher instead.

It now works as expected.


Previous Topic:Acceleo run error
Next Topic:[Acceleo] Multi-model to text transformation
Goto Forum:
  


Current Time: Sun Dec 01 17:30:27 GMT 2024

Powered by FUDForum. Page generated in 0.04518 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top