]> git.sesse.net Git - vlc/commitdiff
skins2: fix .wsz problem
authorErwan Tulou <erwan10@videolan.org>
Tue, 1 Mar 2011 15:45:15 +0000 (16:45 +0100)
committerErwan Tulou <erwan10@videolan.org>
Tue, 1 Mar 2011 20:18:02 +0000 (21:18 +0100)
filenames must always be forced to lower case in the case of .wsz files
(since the winamp2.xml expects them in this form)

modules/gui/skins2/src/ini_file.cpp
modules/gui/skins2/src/theme_loader.cpp
modules/gui/skins2/src/theme_loader.hpp

index 7fe8282eb67ea4c417051f6ce7f1cb580b218f52..58478d2e4c1cc2cc22163061dca150c90bdd96cc 100644 (file)
@@ -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 );
index 769602694d72767c8aeb6ce318c01e98eb4ce98e..b976ff745d9be5cce331265c4e3162f1265a82cb 100644 (file)
@@ -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 );
index 52457d116ec1e6256b16b7a01dedde9ceaadedf6..99d43ac4d3f176821e15c5ed6a81e7cb7505ac38 100644 (file)
@@ -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
     /**