From 15a13bafccb96e6ab0cc5a23af6dd46715fa22c5 Mon Sep 17 00:00:00 2001 From: Zolnai Tamás Date: Fri, 15 Mar 2013 15:42:05 +0100 Subject: Get rid of generating temporary sdf file Working: 1. Localize add header to po files. 2. Executables append po entries to po files. 3. Localize delete entryless po files and empty directories Plus a bunch of clean up. Change-Id: I58e300eaee4cee948203cc9d3e642ca9462d0d26 --- l10ntools/source/cfgmerge.cxx | 65 +++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 43 deletions(-) (limited to 'l10ntools/source/cfgmerge.cxx') diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx index e380b223e0f9..50329fa3f3d2 100644 --- a/l10ntools/source/cfgmerge.cxx +++ b/l10ntools/source/cfgmerge.cxx @@ -73,8 +73,7 @@ FILE * init(int argc, char ** argv) { global::parser.reset( new CfgExport( aArgs.m_sOutputFile.getStr(), aArgs.m_sPrj.getStr(), - common::pathnameToken(global::inputPathname.getStr(), - aArgs.m_sPrjRoot.getStr()))); + global::inputPathname )); } return pFile; @@ -354,30 +353,6 @@ void CfgParser::Error(const rtl::OString& rError) yyerror(rError.getStr()); } -// -// class CfgOutputParser -// - -CfgOutputParser::CfgOutputParser(const rtl::OString &rOutputFile) -{ - pOutputStream.open( - rOutputFile.getStr(), std::ios_base::out | std::ios_base::trunc); - if (!pOutputStream.is_open()) - { - rtl::OStringBuffer sError(RTL_CONSTASCII_STRINGPARAM("ERROR: Unable to open output file: ")); - sError.append(rOutputFile); - Error(sError.makeStringAndClear()); - std::exit(EXIT_FAILURE); - } -} - -/*****************************************************************************/ -CfgOutputParser::~CfgOutputParser() -/*****************************************************************************/ -{ - pOutputStream.close(); -} - // // class CfgExport // @@ -389,10 +364,15 @@ CfgExport::CfgExport( const rtl::OString &rFilePath ) /*****************************************************************************/ - : CfgOutputParser( rOutputFile ), - sPrj( rProject ), + : sPrj( rProject ), sPath( rFilePath ) { + pOutputStream.open( rOutputFile, PoOfstream::APP ); + if (!pOutputStream.isOpen()) + { + std::cerr << "ERROR: Unable to open output file: " << rOutputFile << "\n"; + std::exit(EXIT_FAILURE); + } Export::InitLanguages( false ); aLanguages = Export::GetLanguages(); } @@ -401,6 +381,7 @@ CfgExport::CfgExport( CfgExport::~CfgExport() /*****************************************************************************/ { + pOutputStream.close(); } /*****************************************************************************/ @@ -432,19 +413,9 @@ void CfgExport::WorkOnResourceEnd() sText = Export::UnquoteHTML( sText ); - rtl::OString sOutput( sPrj ); sOutput += "\t"; - sOutput += sPath; - sOutput += "\t0\t"; - sOutput += pStackData->sResTyp; sOutput += "\t"; - sOutput += sGroupId; sOutput += "\t"; - sOutput += sLocalId; sOutput += "\t\t\t0\t"; - sOutput += sCur; - sOutput += "\t"; - - sOutput += sText; sOutput += "\t"; - sOutput += sXComment; sOutput += "\t\t\t"; - - pOutputStream << sOutput.getStr() << '\n'; + Export::writePoEntry( + "Cfgex", pOutputStream, sPath, pStackData->sResTyp, + sGroupId, sLocalId, sXComment, sText); } } } @@ -466,12 +437,19 @@ void CfgExport::WorkOnText( CfgMerge::CfgMerge( const rtl::OString &rMergeSource, const rtl::OString &rOutputFile, const rtl::OString &rFilename) - : CfgOutputParser( rOutputFile ), - pMergeDataFile( NULL ), + : pMergeDataFile( NULL ), pResData( NULL ), sFilename( rFilename ), bEnglish( sal_False ) { + pOutputStream.open( + rOutputFile.getStr(), std::ios_base::out | std::ios_base::trunc); + if (!pOutputStream.is_open()) + { + std::cerr << "ERROR: Unable to open output file: " << rOutputFile << "\n"; + std::exit(EXIT_FAILURE); + } + if (rMergeSource.getLength()) { pMergeDataFile = new MergeDataFile( @@ -491,6 +469,7 @@ CfgMerge::CfgMerge( CfgMerge::~CfgMerge() /*****************************************************************************/ { + pOutputStream.close(); delete pMergeDataFile; delete pResData; } -- cgit