diff options
author | Joachim Lingner <jl@openoffice.org> | 2011-02-24 17:12:55 +0100 |
---|---|---|
committer | Joachim Lingner <jl@openoffice.org> | 2011-02-24 17:12:55 +0100 |
commit | 836a9c057b71dfea52524e2387a2cc0a73479660 (patch) | |
tree | 1e89dfa970a6a437a25b03ae53a056a88f7fe303 /l10ntools/source/help | |
parent | b2a5985ba263eb1c2ce567c5ecadfdfbe8f2c9d0 (diff) |
jl164 #i109096# HelpLinker does not work with long path on Windows XP because of fopen
Diffstat (limited to 'l10ntools/source/help')
-rw-r--r-- | l10ntools/source/help/HelpCompiler.hxx | 7 | ||||
-rwxr-xr-x[-rw-r--r--] | l10ntools/source/help/HelpLinker.cxx | 41 |
2 files changed, 41 insertions, 7 deletions
diff --git a/l10ntools/source/help/HelpCompiler.hxx b/l10ntools/source/help/HelpCompiler.hxx index e300fe26f16d..3426f914d2e6 100644 --- a/l10ntools/source/help/HelpCompiler.hxx +++ b/l10ntools/source/help/HelpCompiler.hxx @@ -102,6 +102,13 @@ namespace fs HCDBG(std::cerr << "native_file_string is " << tmp.getStr() << std::endl); return std::string(tmp.getStr()); } + wchar_t const * native_file_string_w() const + { + ::rtl::OUString ustrSystemPath; + osl::File::getSystemPathFromFileURL(data, ustrSystemPath); + return ustrSystemPath.getStr(); + } + std::string native_directory_string() const { return native_file_string(); } std::string toUTF8() const { diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx index 4e3a4cedbe6f..2c7fa51657e8 100644..100755 --- a/l10ntools/source/help/HelpLinker.cxx +++ b/l10ntools/source/help/HelpLinker.cxx @@ -118,7 +118,13 @@ void IndexerPreProcessor::processDocument { fs::path fsCaptionPureTextFile_docURL = m_fsCaptionFilesDirName / aStdStr_EncodedDocPathURL; std::string aCaptionPureTextFileStr_docURL = fsCaptionPureTextFile_docURL.native_file_string(); - FILE* pFile_docURL = fopen( aCaptionPureTextFileStr_docURL.c_str(), "w" ); +#ifdef WNT //We need _wfopen to support long file paths on Windows XP + FILE* pFile_docURL = _wfopen( + fsCaptionPureTextFile_docURL.native_file_string_w(), L"w" ); +#else + FILE* pFile_docURL = fopen( + fsCaptionPureTextFile_docURL.native_file_string().c_str(), "w" ); +#endif if( pFile_docURL ) { fprintf( pFile_docURL, "%s\n", pResNodeCaption->content ); @@ -135,8 +141,13 @@ void IndexerPreProcessor::processDocument if( pResNodeContent ) { fs::path fsContentPureTextFile_docURL = m_fsContentFilesDirName / aStdStr_EncodedDocPathURL; - std::string aContentPureTextFileStr_docURL = fsContentPureTextFile_docURL.native_file_string(); - FILE* pFile_docURL = fopen( aContentPureTextFileStr_docURL.c_str(), "w" ); +#ifdef WNT //We need _wfopen to support long file paths on Windows XP + FILE* pFile_docURL = _wfopen( + fsContentPureTextFile_docURL.native_file_string_w(), L"w" ); +#else + FILE* pFile_docURL = fopen( + fsContentPureTextFile_docURL.native_file_string().c_str(), "w" ); +#endif if( pFile_docURL ) { fprintf( pFile_docURL, "%s\n", pResNodeContent->content ); @@ -226,9 +237,13 @@ public: } } - void dump_DBHelp( const std::string& rFileName ) + void dump_DBHelp( const fs::path& rFileName ) { - FILE* pFile = fopen( rFileName.c_str(), "wb" ); +#ifdef WNT //We need _wfopen to support long file paths on Windows XP + FILE* pFile = _wfopen( rFileName.native_file_string_w(), L"wb" ); +#else + FILE* pFile = fopen( rFileName.native_file_string_w().c_str(), "wb" ); +#endif if( pFile == NULL ) return; @@ -430,9 +445,15 @@ void HelpLinker::link() throw( HelpProcessingException ) #endif fs::path helpTextFileName_DBHelp(indexDirParentName / (mod + (bUse_ ? ".ht_" : ".ht"))); +#ifdef WNT + //We need _wfopen to support long file paths on Windows XP + FILE* pFileHelpText_DBHelp = _wfopen + ( helpTextFileName_DBHelp.native_file_string_w(), L"wb" ); +#else + FILE* pFileHelpText_DBHelp = fopen ( helpTextFileName_DBHelp.native_file_string().c_str(), "wb" ); - +#endif DB* dbBase(0); #ifndef DBHELP_ONLY fs::path dbBaseFileName(indexDirParentName / (mod + ".db")); @@ -442,8 +463,14 @@ void HelpLinker::link() throw( HelpProcessingException ) #endif fs::path dbBaseFileName_DBHelp(indexDirParentName / (mod + (bUse_ ? ".db_" : ".db"))); +#ifdef WNT + //We need _wfopen to support long file paths on Windows XP + FILE* pFileDbBase_DBHelp = _wfopen + ( dbBaseFileName_DBHelp.native_file_string_w(), L"wb" ); +#else FILE* pFileDbBase_DBHelp = fopen ( dbBaseFileName_DBHelp.native_file_string().c_str(), "wb" ); +#endif #ifndef DBHELP_ONLY DB* keyWord(0); @@ -692,7 +719,7 @@ void HelpLinker::link() throw( HelpProcessingException ) if( pFileDbBase_DBHelp != NULL ) fclose( pFileDbBase_DBHelp ); - helpKeyword.dump_DBHelp( keyWordFileName_DBHelp.native_file_string() ); + helpKeyword.dump_DBHelp( keyWordFileName_DBHelp); if( !bExtensionMode ) { |