diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-02-08 22:07:23 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-02-08 22:07:23 +0100 |
commit | e960410674fc6761025ca1a63f88352a7049fbb5 (patch) | |
tree | e593107b2c9c699d53a2e01c34450829527b48b6 /l10ntools/source/xmlparse.cxx | |
parent | aa11b4c86e4b41be542623b7d98a3fb8e5d30745 (diff) |
Various more l10ntools clean up
Diffstat (limited to 'l10ntools/source/xmlparse.cxx')
-rw-r--r-- | l10ntools/source/xmlparse.cxx | 53 |
1 files changed, 10 insertions, 43 deletions
diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx index d6010960c2ff..c21d9e526132 100644 --- a/l10ntools/source/xmlparse.cxx +++ b/l10ntools/source/xmlparse.cxx @@ -239,51 +239,18 @@ sal_uInt16 XMLFile::GetNodeType() return XML_NODE_TYPE_FILE; } -/*****************************************************************************/ -sal_Bool XMLFile::Write( rtl::OString const &aFilename ) -/*****************************************************************************/ +void XMLFile::Write( rtl::OString const &aFilename ) { - - if ( !aFilename.isEmpty()) { - // retry harder if there is a NFS problem, - for( int x = 1 ; x < 3 ; x++ ){ // this looks strange...yes! - ofstream aFStream( aFilename.getStr() , ios::out | ios::trunc ); - - if( !aFStream ) // From time to time the stream can not be opened the first time on NFS volumes, - { // I wasn't able to track this down. I think this is an NFS issue ..... - TimeValue aTime; - aTime.Seconds = 3; - aTime.Nanosec = 0; - - osl::Thread::wait( aTime ); - } - else - { - // write out - Write( aFStream ); - aFStream.close(); - - // check! - DirEntry aTarget( aFilename ); - FileStat aFileStat( aTarget ); - - if( aFileStat.GetSize() < 1 ) - { - //retry - aTarget.Kill(); - } - else - { - //everything ok! - return true; - } - } - } - cerr << "ERROR: - helpex - Can't create file " << aFilename.getStr() << "\nPossible reason: Disk full ? Mounted NFS volume broken ? Wrong permissions ?\n"; - exit( -1 ); + std::ofstream s( + aFilename.getStr(), std::ios_base::out | std::ios_base::trunc); + if (!s.is_open()) { + std::cerr + << "Error: helpex cannot create file " << aFilename.getStr() + << '\n'; + std::exit(EXIT_FAILURE); } - cerr << "ERROR: - helpex - Empty file name\n"; - exit( -1 ); + Write(s); + s.close(); } void XMLFile::WriteString( ofstream &rStream, const rtl::OUString &sString ) |