summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-01-30 13:41:53 +0100
committerStephan Bergmann <sbergman@redhat.com>2013-01-30 13:47:12 +0100
commite63bfb3035cd01983600a23ab289601dd9b2cf11 (patch)
tree1b5bbeb8e827eb0fc7d3ba52040cf2233954ec95 /tools
parent53927349241643abc2a083f1983c46ec793e6ff1 (diff)
Get rid of STAR_RESOURCEPATH
...the only remaining use was for CppunitTest to find the .res files in $(OUTDIR)/bin/. Get that solved by delivering the .res files also to $(OUTDIR)/unittest/install/program/resource/ (new gb_ResTarget_get_unittest_target). Change-Id: I370e7cab4223256356c7511b88ae63d9c0dbf215
Diffstat (limited to 'tools')
-rw-r--r--tools/source/rc/resmgr.cxx89
1 files changed, 28 insertions, 61 deletions
diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx
index 17b75ee5a1d0..4d578f3a39a5 100644
--- a/tools/source/rc/resmgr.cxx
+++ b/tools/source/rc/resmgr.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "sal/config.h"
+
+#include <cassert>
+
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@@ -176,77 +180,40 @@ void ResMgrContainer::release()
void ResMgrContainer::init()
{
- // get resource path
- std::list< OUString > aDirs;
- sal_Int32 nIndex = 0;
+ assert( m_aResFiles.empty() );
- // 1. fixed locations
+ // get resource path
rtl::OUString uri(
- RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/program/resource"));
- rtl::Bootstrap::expandMacros(uri);
- aDirs.push_back(uri);
-
- // 2. in STAR_RESOURCEPATH
- const sal_Char* pEnv = getenv( "STAR_RESOURCEPATH" );
- if( pEnv )
- {
- OUString aEnvPath( OStringToOUString( OString( pEnv ), osl_getThreadTextEncoding() ) );
- nIndex = 0;
- while( nIndex >= 0 )
- {
- OUString aPathElement( aEnvPath.getToken( 0, SAL_PATHSEPARATOR, nIndex ) );
- if( !aPathElement.isEmpty() )
- {
- OUString aFileURL;
- File::getFileURLFromSystemPath( aPathElement, aFileURL );
- aDirs.push_back( aFileURL);
- }
- }
- }
+ RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/program/resource/"));
+ rtl::Bootstrap::expandMacros(uri); //TODO: detect failure
// collect all possible resource files
- for( std::list< OUString >::const_iterator dir_it = aDirs.begin(); dir_it != aDirs.end(); ++dir_it )
+ Directory aDir( uri );
+ if( aDir.open() == FileBase::E_None )
{
- Directory aDir( *dir_it );
- if( aDir.open() == FileBase::E_None )
+ DirectoryItem aItem;
+ while( aDir.getNextItem( aItem ) == FileBase::E_None )
{
- DirectoryItem aItem;
- while( aDir.getNextItem( aItem ) == FileBase::E_None )
+ FileStatus aStatus(osl_FileStatus_Mask_FileName);
+ if( aItem.getFileStatus( aStatus ) == FileBase::E_None )
{
- FileStatus aStatus(osl_FileStatus_Mask_FileName);
- if( aItem.getFileStatus( aStatus ) == FileBase::E_None )
- {
- OUString aFileName = aStatus.getFileName();
- if( aFileName.getLength() < 5 )
- continue;
- if( ! aFileName.endsWithIgnoreAsciiCaseAsciiL( ".res", 4 ) )
- continue;
- OUString aResName = aFileName.copy( 0, aFileName.getLength()-4 );
- if( m_aResFiles.find( aResName ) != m_aResFiles.end() )
- continue;
- OUStringBuffer aURL( dir_it->getLength() + aFileName.getLength() + 1 );
- aURL.append( *dir_it );
- if( !dir_it->endsWithIgnoreAsciiCaseAsciiL( "/", 1 ) )
- aURL.append( sal_Unicode('/') );
- aURL.append( aFileName );
- m_aResFiles[ aResName ].aFileURL = aURL.makeStringAndClear();
- }
+ OUString aFileName = aStatus.getFileName();
+ if( ! aFileName.endsWithIgnoreAsciiCase( ".res" ) )
+ continue;
+ OUString aResName = aFileName.copy( 0, aFileName.getLength() - strlen(".res") );
+ if( aResName.isEmpty() )
+ continue;
+ assert( m_aResFiles.find( aResName ) == m_aResFiles.end() );
+ m_aResFiles[ aResName ].aFileURL = uri + aFileName;
+ SAL_INFO(
+ "tools.rc",
+ "ResMgrContainer: " << aResName << " -> "
+ << m_aResFiles[ aResName ].aFileURL );
}
}
- #if OSL_DEBUG_LEVEL > 1
- else
- OSL_TRACE( "opening dir %s failed", OUStringToOString( *dir_it, osl_getThreadTextEncoding() ).getStr() );
- #endif
}
- #if OSL_DEBUG_LEVEL > 1
- for( boost::unordered_map< OUString, ContainerElement, OUStringHash >::const_iterator it =
- m_aResFiles.begin(); it != m_aResFiles.end(); ++it )
- {
- OSL_TRACE( "ResMgrContainer: %s -> %s",
- OUStringToOString( it->first, osl_getThreadTextEncoding() ).getStr(),
- OUStringToOString( it->second.aFileURL, osl_getThreadTextEncoding() ).getStr() );
- }
- #endif
+ else
+ SAL_WARN( "tools.rc", "opening dir " << uri << " failed" );
// set default language
LanguageType nLang = MsLangId::getSystemUILanguage();