Commit 39c66042 authored by Erwan Tulou's avatar Erwan Tulou

skins2: fix .wsz problem

filenames must always be forced to lower case in the case of .wsz files
(since the winamp2.xml expects them in this form)
parent 5d5eeb9e
......@@ -68,13 +68,11 @@ void IniFile::parseFile()
string name = m_name + "." + section + "." + var;
#ifdef WIN32
// Convert to lower case because of some buggy winamp2 skins
for( size_t i=0; i< name.size(); i++)
for( size_t i = 0; i < name.size(); i++ )
{
name[i] = tolower( name[i] );
}
#endif
// Register the value in the var manager
pVarManager->registerConst( name, val );
......
......@@ -136,6 +136,8 @@ bool ThemeLoader::extractTarGz( const string &tarFile, const string &rootDir )
bool ThemeLoader::extractZip( const string &zipFile, const string &rootDir )
{
bool b_isWsz = strstr( zipFile.c_str(), ".wsz" );
// Try to open the ZIP file
unzFile file = unzOpen( zipFile.c_str() );
unz_global_info info;
......@@ -147,7 +149,7 @@ bool ThemeLoader::extractZip( const string &zipFile, const string &rootDir )
// Extract all the files in the archive
for( unsigned long i = 0; i < info.number_entry; i++ )
{
if( !extractFileInZip( file, rootDir ) )
if( !extractFileInZip( file, rootDir, b_isWsz ) )
{
msg_Warn( getIntf(), "error while unzipping %s",
zipFile.c_str() );
......@@ -172,7 +174,8 @@ bool ThemeLoader::extractZip( const string &zipFile, const string &rootDir )
}
bool ThemeLoader::extractFileInZip( unzFile file, const string &rootDir )
bool ThemeLoader::extractFileInZip( unzFile file, const string &rootDir,
bool isWsz )
{
// Read info for the current file
char filenameInZip[256];
......@@ -184,16 +187,11 @@ bool ThemeLoader::extractFileInZip( unzFile file, const string &rootDir )
return false;
}
#ifdef WIN32
// Convert the file name to lower case, because some winamp skins
// use the wrong case...
for( size_t i=0; i< strlen( filenameInZip ); i++)
{
filenameInZip[i] = tolower( filenameInZip[i] );
}
#endif
if( isWsz )
for( size_t i = 0; i < strlen( filenameInZip ); i++ )
filenameInZip[i] = tolower( filenameInZip[i] );
// Allocate the buffer
void *pBuffer = malloc( ZIP_BUFFER_SIZE );
......
......@@ -64,7 +64,7 @@ private:
/**
* Expects a string from the current locale.
*/
bool extractFileInZip( unzFile file, const string &rootDir );
bool extractFileInZip( unzFile file, const string &rootDir, bool isWsz );
/// Clean up the temporary files created by the extraction
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment