Statistics
| Revision:

root / tmp / org.txm.groovy.core / src / groovy / org / txm / setup / FixQuotesInProperties.groovy @ 812

History | View | Annotate | Download (625 Bytes)

1
package org.txm.setup
2

    
3
File propDirFile = new File("/home/mdecorde/workspace441/org.txm.core/src/java/org/txm")
4

    
5
for (File propFile : propDirFile.listFiles()) {
6
        if (!propFile.getName().endsWith(".properties")) continue;
7

    
8
        println "FILE: $propFile"
9
        String text = propFile.getText("iso-8859-1")
10

    
11
        propFile.withWriter("iso-8859-1") { writer->
12
                for (String line : text.split("\n")) {
13
                        if (line.contains("{0}") || line.contains("{1}") || line.contains("{2}") || line.contains("{3}")) {
14
                                writer.println line.replaceAll("''", "'").replaceAll("''", "'").replaceAll("'", "''")
15
                        } else {
16
                                writer.println line
17
                        }
18
                }
19
        }
20
}