Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 357202 - separator('\n') uses linux line separator instead of system line separator
Summary: separator('\n') uses linux line separator instead of system line separator
Status: CLOSED FIXED
Alias: None
Product: Acceleo
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 enhancement
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 366058 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-09-09 04:27 EDT by Laurent Delaigue CLA
Modified: 2015-05-27 08:54 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent Delaigue CLA 2011-09-09 04:27:01 EDT
Build Identifier: 3.1.0.v20110607-0602

When I use a [for (...) separator('\n')]x[/for]
I get linux line separator even though I'm using windows.

I would expect the line separator used to be the system line separator...

I haven't checked with ->sep('\n')

Reproducible: Always
Comment 1 Stephane Begaudeau CLA 2011-09-09 04:32:17 EDT
This mechanism is very straightforward we are just putting the content of "separator" after each call to the for. We could detect that the separator contains a line separator and then replace it with the OS specific line separator.

"->sep'\n')" should work the same way.
Comment 2 Stephane Begaudeau CLA 2012-02-20 05:21:45 EST
Acceleo 3.3.0 will provides two ways to handle problems with line separators. A new operation defined on String and returning a Sequence(String) is available to split a block of text at each line separator. This way a block of text from a model or a properties file using OS specific line separator can be generated with something like this:

[for (line: String | myBlock.tokenizeLine())]
[line/]
[/for]

Another operation defined an OclAny and as such available for every element during the generation (like getProperty('')) will let user get the currently used line separator so in your case you would write something like this:

[for (...) separator(lineSeparator())]x[/for]

When running inside of Eclipse, we will use the Eclipse defined line separator if it has been set by the user in the preferences, the OS specific line separator will be used otherwise. This access to the value of the line separator is defined as an operation and not as a variable for various implementation and tooling reasons (and the drawback, two parenthesis, is not that bad).
Comment 3 Stephane Begaudeau CLA 2012-02-20 07:40:12 EST
*** Bug 366058 has been marked as a duplicate of this bug. ***
Comment 4 Laurent Goubet CLA 2015-05-27 08:54:46 EDT
Closing resolved bugs