|
hello
I am using Groovy to generate the config file for Cruise Control. I have this code: def configFile = new File(CC_CONFIG) configFile.createNewFile() configFile << "<cruisecontrol>\n\n" ..... writing the file works. but when the file already exists, the new content is appended. how can I overwrite the existing file with the new content ? called "createNewFile" didn't work. I couldn't find anything in the docs. best wishes Markus ___________________________________________________________ Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
Try something like
def w = configFile.newWriter() w << "..." http://groovy.codehaus.org/groovy-jdk.html#meth88 On 7/16/07, Markus Jais <[hidden email]> wrote: > hello > > I am using Groovy to generate the config file for > Cruise Control. > > I have this code: > > def configFile = new File(CC_CONFIG) > configFile.createNewFile() > configFile << "<cruisecontrol>\n\n" > ..... > > > writing the file works. but when the file already > exists, the new content is appended. how can I > overwrite the existing file with the new content ? > > called "createNewFile" didn't work. I couldn't find > anything in the docs. > > best wishes > > Markus > > > > > > > > ___________________________________________________________ > Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de > > --------------------------------------------------------------------- > To unsubscribe from this list please visit: > > http://xircles.codehaus.org/manage_email > > -- Guillaume Laforge Groovy Project Manager http://glaforge.free.fr/blog/groovy --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
thank you, Guillaume. exactly what I needed.
Markus --- Guillaume Laforge <[hidden email]> schrieb: > Try something like > > def w = configFile.newWriter() > w << "..." > > http://groovy.codehaus.org/groovy-jdk.html#meth88 > > On 7/16/07, Markus Jais <[hidden email]> > wrote: > > hello > > > > I am using Groovy to generate the config file for > > Cruise Control. > > > > I have this code: > > > > def configFile = new File(CC_CONFIG) > > configFile.createNewFile() > > configFile << "<cruisecontrol>\n\n" > > ..... > > > > > > writing the file works. but when the file already > > exists, the new content is appended. how can I > > overwrite the existing file with the new content ? > > > > called "createNewFile" didn't work. I couldn't > find > > anything in the docs. > > > > best wishes > > > > Markus > > > > > > > > > > > > > > > > > > > Der frühe Vogel fängt den Wurm. Hier gelangen Sie > zum neuen Yahoo! Mail: http://mail.yahoo.de > > > > > --------------------------------------------------------------------- > > To unsubscribe from this list please visit: > > > > http://xircles.codehaus.org/manage_email > > > > > > > -- > Guillaume Laforge > Groovy Project Manager > http://glaforge.free.fr/blog/groovy > > > To unsubscribe from this list please visit: > > http://xircles.codehaus.org/manage_email > > -- Markus Jais http://www.mjais.de ___________________________________________________________ Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
| Powered by Nabble | Edit this page |
