From 0016bf68da61c9382d1d282fc2645cf656e78cb3 Mon Sep 17 00:00:00 2001 From: christoph Date: Fri, 28 Oct 2016 09:41:06 +0200 Subject: [PATCH] Fixes Issue #1: program tried to write missing translations to file c:\temp\missing.txt and crashed if c:\temp did not exist. Moved location to %temp%-Directory and changed g_nReportMissing to FALSE to disabled writing missing.txt at all. --- Language.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Language.cpp b/Language.cpp index 9ed7fb3..dbd131c 100644 --- a/Language.cpp +++ b/Language.cpp @@ -34,6 +34,7 @@ // static int g_nReportMissing = QueryModuleDebugLevel( _T( "ReportMissingLangIDs" ) ); static int g_nReportMissing = TRUE; // QueryModuleDebugLevel( _T( "ReportMissingLangIDs" ) ); +static TCHAR missingTxtPath[_MAX_PATH + 1]; ////////////////////////////////////////////////////////////////////// // Construction/Destruction @@ -52,8 +53,13 @@ CLanguage::CLanguage() m_dwCodePageID = 1252; // STANDARD CODE PAGE ANSI INTERNATIONAL m_dwSubLangID = SUBLANG_DEFAULT; m_dwLangID = LANG_ENGLISH; + + memset(missingTxtPath, 0, _MAX_PATH + 1); + GetTempPath(_MAX_PATH, missingTxtPath); + _tcsncat(missingTxtPath, _T("missing.txt"), _MAX_PATH); } + CLanguage::~CLanguage() { } @@ -84,7 +90,7 @@ void CLanguage::ReportMissingID( int nID, const CUString& strEnglish, int nType EncodeTab( strWrite ); - if ( cFile.Open( _T( "c:\\temp\\missing.txt" ), + if ( cFile.Open(missingTxtPath, CFile::modeReadWrite | CFile::modeNoTruncate | CFile::modeCreate ) ) { while ( cFile.ReadString( strRead ) ) @@ -136,7 +142,7 @@ void CLanguage::ReportChangedID( int nID, const CUString& strResource, const CUS EncodeTab( strWrite ); - if ( cFile.Open( _T( "c:\\temp\\missing.txt" ), + if ( cFile.Open( missingTxtPath, CFile::modeReadWrite | CFile::modeNoTruncate | CFile::modeCreate ) ) { while ( cFile.ReadString( strRead ) )