#include "../src/vlcproc.hpp"
#include "../src/window_manager.hpp"
-#include <cctype>
-
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
# include <direct.h>
#endif
-#ifdef HAVE_DIRENT_H
-# include <dirent.h>
-#endif
-
-
#if defined( HAVE_ZLIB_H )
# include <zlib.h>
# include <errno.h>
//Before all, let's see if the file is present
struct stat p_stat;
- if( utf8_stat( path.c_str(), &p_stat ) )
+ if( vlc_stat( fileName.c_str(), &p_stat ) )
return false;
// First, we try to un-targz the file, and if it fails we hope it's a XML
Theme *pNewTheme = getIntf()->p_sys->p_theme;
if( !pNewTheme )
- {
return false;
- }
- // Check if the skin to load is in the config file, to load its config
- char *skin_last = config_GetPsz( getIntf(), "skins2-last" );
- if( skin_last != NULL && fileName == (string)skin_last )
- {
- // Restore the theme configuration
- getIntf()->p_sys->p_theme->loadConfig();
- // Used to anchor the windows at the beginning
- pNewTheme->getWindowManager().stopMove();
- }
- else
- {
- config_PutPsz( getIntf(), "skins2-last", fileName.c_str() );
- // Show the windows
- pNewTheme->getWindowManager().showAll( true );
- }
- if( skin_last ) free( skin_last );
+ // Restore the theme configuration
+ getIntf()->p_sys->p_theme->loadConfig();
- // The new theme cannot embed a video output yet
- VlcProc::instance( getIntf() )->dropVout();
+ // Retain new loaded skins in config
+ config_PutPsz( getIntf(), "skins2-last", fileName.c_str() );
return true;
}
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
+
// Allocate the buffer
void *pBuffer = malloc( ZIP_BUFFER_SIZE );
if( !pBuffer )
- {
- msg_Err( getIntf(), "failed to allocate memory" );
return false;
- }
// Get the path of the file
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
// Start the parser
SkinParser parser( getIntf(), xmlFile, path );
if( ! parser.parse() )
- {
- msg_Err( getIntf(), "failed to parse %s", xmlFile.c_str() );
return false;
- }
// Build and store the theme
Builder builder( getIntf(), parser.getData(), path );
char *pszDirContent;
// Open the dir
- pCurrDir = utf8_opendir( rootDir.c_str() );
+ pCurrDir = vlc_opendir( rootDir.c_str() );
if( pCurrDir == NULL )
{
}
// While we still have entries in the directory
- while( ( pszDirContent = utf8_readdir( pCurrDir ) ) != NULL )
+ while( ( pszDirContent = vlc_readdir( pCurrDir ) ) != NULL )
{
string newURI = rootDir + sep + pszDirContent;
#if defined( S_ISDIR )
struct stat stat_data;
- if( ( utf8_stat( newURI.c_str(), &stat_data ) == 0 )
+ if( ( vlc_stat( newURI.c_str(), &stat_data ) == 0 )
&& S_ISDIR(stat_data.st_mode) )
#elif defined( DT_DIR )
if( pDirContent->d_type & DT_DIR )
switch( buffer.header.typeflag )
{
- case DIRTYPE:
- makedir( fname );
- break;
- case REGTYPE:
- case AREGTYPE:
- remaining = getoct( buffer.header.size, 12 );
- if( remaining )
+ case DIRTYPE:
+ makedir( fname );
+ break;
+ case REGTYPE:
+ case AREGTYPE:
+ remaining = getoct( buffer.header.size, 12 );
+ if( !remaining ) outfile = NULL; else
+ {
+ outfile = fopen( fname, "wb" );
+ if( outfile == NULL )
{
- outfile = fopen( fname, "wb" );
- if( outfile == NULL )
+ /* try creating directory */
+ char *p = strrchr( fname, '/' );
+ if( p != NULL )
{
- /* try creating directory */
- char *p = strrchr( fname, '/' );
- if( p != NULL )
+ *p = '\0';
+ makedir( fname );
+ *p = '/';
+ outfile = fopen( fname, "wb" );
+ if( !outfile )
{
- *p = '\0';
- makedir( fname );
- *p = '/';
- outfile = fopen( fname, "wb" );
- if( !outfile )
- {
- fprintf( stderr, "tar couldn't create %s\n",
- fname );
- }
+ fprintf( stderr, "tar couldn't create %s\n",
+ fname );
}
}
}
- else outfile = NULL;
+ }
/*
* could have no contents
{
fprintf( stderr, "error writing %s skipping...\n", fname );
fclose( outfile );
+ outfile = NULL;
unlink( fname );
}
}
switch( oflags )
{
- case O_WRONLY:
- gzflags = "wb";
- break;
- case O_RDONLY:
- gzflags = "rb";
- break;
- case O_RDWR:
- default:
- errno = EINVAL;
- return -1;
+ case O_WRONLY:
+ gzflags = "wb";
+ break;
+ case O_RDONLY:
+ gzflags = "rb";
+ break;
+ case O_RDWR:
+ default:
+ errno = EINVAL;
+ return -1;
}
gzf = gzopen( pathname, gzflags );