Commit f92239f0 authored by Hannes Domani's avatar Hannes Domani Committed by Jean-Baptiste Kempf

Portable windows build

If a portable/ folder is next to the libvlccore.dll binary, it will use
it for most configuration and other files.

Close #9751, #2114 and #12679
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent bbe49958
......@@ -483,6 +483,15 @@ static void *Thread( void *obj )
/* All the settings are in the .conf/.ini style */
#ifdef _WIN32
char *cConfigDir = config_GetUserDir( VLC_CONFIG_DIR );
QString configDir = cConfigDir;
free( cConfigDir );
if( configDir.endsWith( "\\vlc" ) )
configDir.chop( 4 ); /* the "\vlc" dir is added again by QSettings */
QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, configDir );
#endif
p_intf->p_sys->mainSettings = new QSettings(
#ifdef _WIN32
QSettings::IniFormat,
......
......@@ -87,6 +87,21 @@ static char *config_GetShellDir (int csidl)
static char *config_GetAppDir (void)
{
/* if portable directory exists, use it */
TCHAR path[MAX_PATH];
if (GetModuleFileName (NULL, path, MAX_PATH))
{
TCHAR *lastDir = _tcsrchr (path, '\\');
if (lastDir)
{
_tcscpy (lastDir + 1, TEXT("portable"));
DWORD attrib = GetFileAttributes (path);
if (attrib != INVALID_FILE_ATTRIBUTES &&
(attrib & FILE_ATTRIBUTE_DIRECTORY))
return FromT (path);
}
}
char *psz_dir;
char *psz_parent = config_GetShellDir (CSIDL_APPDATA);
......
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