From b2a5985ba263eb1c2ce567c5ecadfdfbe8f2c9d0 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Thu, 24 Feb 2011 10:37:10 +0100 Subject: jl164 #i109096# java help indexer service did not work with long file paths --- l10ntools/source/help/HelpIndexerTool.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'l10ntools') diff --git a/l10ntools/source/help/HelpIndexerTool.java b/l10ntools/source/help/HelpIndexerTool.java index a39b5399e38d..c20d9f108ced 100644 --- a/l10ntools/source/help/HelpIndexerTool.java +++ b/l10ntools/source/help/HelpIndexerTool.java @@ -45,6 +45,15 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.util.Date; + +/** + When this tool is used with long path names on Windows, that is paths which start + with \\?\, then the caller must make sure that the path is unique. This is achieved + by removing '.' and '..' from the path. Paths which are created by + osl_getSystemPathFromFileURL fulfill this requirement. This is necessary because + lucene is patched to not use File.getCanonicalPath. See long_path.patch in the lucene + module. + */ public class HelpIndexerTool { public HelpIndexerTool() -- cgit v1.2.3 From 836a9c057b71dfea52524e2387a2cc0a73479660 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Thu, 24 Feb 2011 17:12:55 +0100 Subject: jl164 #i109096# HelpLinker does not work with long path on Windows XP because of fopen --- l10ntools/source/help/HelpCompiler.hxx | 7 ++++++ l10ntools/source/help/HelpLinker.cxx | 41 ++++++++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 7 deletions(-) mode change 100644 => 100755 l10ntools/source/help/HelpLinker.cxx (limited to 'l10ntools') 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 old mode 100644 new mode 100755 index 4e3a4cedbe6f..2c7fa51657e8 --- 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 ) { -- cgit v1.2.3 From 3de320a3c332ace5bbe9adc9fa3a5960104e365b Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Wed, 2 Mar 2011 16:45:19 +0100 Subject: jl164 #i109096# make patch::native_file_string_w windows only --- l10ntools/source/help/HelpCompiler.hxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 l10ntools/source/help/HelpCompiler.hxx (limited to 'l10ntools') diff --git a/l10ntools/source/help/HelpCompiler.hxx b/l10ntools/source/help/HelpCompiler.hxx old mode 100644 new mode 100755 index 3426f914d2e6..8ce6098d21a9 --- a/l10ntools/source/help/HelpCompiler.hxx +++ b/l10ntools/source/help/HelpCompiler.hxx @@ -102,13 +102,14 @@ namespace fs HCDBG(std::cerr << "native_file_string is " << tmp.getStr() << std::endl); return std::string(tmp.getStr()); } +#ifdef WNT wchar_t const * native_file_string_w() const { ::rtl::OUString ustrSystemPath; osl::File::getSystemPathFromFileURL(data, ustrSystemPath); return ustrSystemPath.getStr(); } - +#endif std::string native_directory_string() const { return native_file_string(); } std::string toUTF8() const { -- cgit v1.2.3 From 6b907a7f7a788731268b4f612e8d8a9fd053d049 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Wed, 2 Mar 2011 17:23:32 +0100 Subject: jl164 #i109096# wrong use of path::native_file_string_w in fopen for Linux --- l10ntools/source/help/HelpLinker.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'l10ntools') diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx index 2c7fa51657e8..036208520ede 100755 --- a/l10ntools/source/help/HelpLinker.cxx +++ b/l10ntools/source/help/HelpLinker.cxx @@ -242,7 +242,7 @@ public: #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" ); + FILE* pFile = fopen( rFileName.native_file_string().c_str(), "wb" ); #endif if( pFile == NULL ) return; -- cgit v1.2.3