Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] - change file access rights from within Acceleo
[Acceleo] - change file access rights from within Acceleo [message #846676] Mon, 16 April 2012 16:04 Go to next message
Missing name Missing name is currently offline Missing name Missing nameFriend
Messages: 1
Registered: February 2010
Junior Member
All,

I have a code generator that generates ~60 files (out of overall ~200) for a rather complex SW baseline. In order to keep track of the changes I tend to make all files write protected before starting to make major changes. Now when the generators run I need to change the access rights of the files (only the ones that are overwritten) to right access.

Is there a simple way to do this from within the code generator. i.e. just before the [file ('XYZ',....)/] I want to check if the file exists, check the access right and if it is write protected change that.

rgds

Hermann
Re: [Acceleo] - change file access rights from within Acceleo [message #847298 is a reply to message #846676] Tue, 17 April 2012 07:11 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi,

This is done for you if you change the generation strategy used by Acceleo for your generator. In the generated Java class, override getGenerationStrategy and change its implementation to "return new WorkspaceAwareStrategy()". Do take note that this strategy cannot be used in standalone.

You can also create your own strategy in order to make one that checks for access rights of java.io.Files : the strategy is the entry point for such use cases.

Laurent Goubet
Obeo
Previous Topic:[XPAND] Ecore to Text with XPand
Next Topic:[Acceleo] The generated code contains only the name of the first class
Goto Forum:
  


Current Time: Wed Apr 24 14:50:10 GMT 2024

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

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

Back to the top