{
bool result = true;
char *tmpdir = tempnam( NULL, "vlt" );
- string tempPath = tmpdir;
+ string tempPath = sFromLocale( tmpdir );
free( tmpdir );
// Extract the file in a temporary directory
list<string>::const_iterator it;
for( it = resPath.begin(); it != resPath.end(); it++ )
{
- if( findFile( sToLocale( *it ), WINAMP2_XML_FILE, xmlFile ) )
+ if( findFile( *it, WINAMP2_XML_FILE, xmlFile ) )
break;
}
}
const string &sep = OSFactory::instance( getIntf() )->getDirSeparator();
DIR *pCurrDir;
- struct dirent *pDirContent;
+ char *pszDirContent;
// Open the dir
- pCurrDir = opendir( rootDir.c_str() );
+ pCurrDir = utf8_opendir( rootDir.c_str() );
if( pCurrDir == NULL )
{
return false;
}
- // Get the first directory entry
- pDirContent = (dirent*)readdir( pCurrDir );
-
// While we still have entries in the directory
- while( pDirContent != NULL )
+ while( ( pszDirContent = utf8_readdir( pCurrDir ) ) != NULL )
{
- string newURI = rootDir + sep + pDirContent->d_name;
+ string newURI = rootDir + sep + pszDirContent;
// Skip . and ..
- if( string( pDirContent->d_name ) != "." &&
- string( pDirContent->d_name ) != ".." )
+ if( string( pszDirContent ) != "." &&
+ string( pszDirContent ) != ".." )
{
#if defined( S_ISDIR )
struct stat stat_data;
- stat( newURI.c_str(), &stat_data );
- if( S_ISDIR(stat_data.st_mode) )
+
+ if( ( utf8_stat( newURI.c_str(), &stat_data ) == 0 )
+ && S_ISDIR(stat_data.st_mode) )
#elif defined( DT_DIR )
if( pDirContent->d_type & DT_DIR )
#else
// Can we find the file in this subdirectory?
if( findFile( newURI, rFileName, themeFilePath ) )
{
+ free( pszDirContent );
closedir( pCurrDir );
return true;
}
else
{
// Found the theme file?
- if( rFileName == string( pDirContent->d_name ) )
+ if( rFileName == string( pszDirContent ) )
{
- themeFilePath = sFromLocale( newURI );
+ themeFilePath = newURI;
+ free( pszDirContent );
closedir( pCurrDir );
return true;
}
}
}
- pDirContent = (dirent*)readdir( pCurrDir );
+ free( pszDirContent );
}
closedir( pCurrDir );