Commit d34d23f5 authored by Antoine Cellerier's avatar Antoine Cellerier

* under windows, default directory to save snapshots is now the user's

   My Pictures (or Mes Images ... depending on locale) directory
parent 62bf4dd2
......@@ -275,6 +275,60 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
asprintf( &val.psz_string, "%s/Desktop",
p_vout->p_vlc->psz_homedir );
}
#elif defined(WIN32) && !defined(UNDER_CE)
if( !val.psz_string && p_vout->p_vlc->psz_homedir )
{
/* Get the My Pictures folder path */
char *p_mypicturesdir = NULL;
typedef HRESULT (WINAPI *SHGETFOLDERPATH)( HWND, int, HANDLE, DWORD,
LPSTR );
#ifndef CSIDL_FLAG_CREATE
# define CSIDL_FLAG_CREATE 0x8000
#endif
#ifndef CSIDL_MYPICTURES
# define CSIDL_MYPICTURES 0x27
#endif
#ifndef SHGFP_TYPE_CURRENT
# define SHGFP_TYPE_CURRENT 0
#endif
HINSTANCE shfolder_dll;
SHGETFOLDERPATH SHGetFolderPath ;
/* load the shfolder dll to retrieve SHGetFolderPath */
if( ( shfolder_dll = LoadLibrary( _T("SHFolder.dll") ) ) != NULL )
{
SHGetFolderPath = (void *)GetProcAddress( shfolder_dll,
_T("SHGetFolderPathA") );
if ( SHGetFolderPath != NULL )
{
p_mypicturesdir = (char *)malloc( MAX_PATH );
if( p_mypicturesdir )
{
if( S_OK != SHGetFolderPath( NULL,
CSIDL_MYPICTURES | CSIDL_FLAG_CREATE,
NULL, SHGFP_TYPE_CURRENT,
p_mypicturesdir ) )
{
free( p_mypicturesdir );
p_mypicturesdir = NULL;
}
}
}
FreeLibrary( shfolder_dll );
}
if( p_mypicturesdir == NULL){
asprintf( &val.psz_string, "%s/" CONFIG_DIR,
p_vout->p_vlc->psz_homedir );
} else {
asprintf( &val.psz_string, p_mypicturesdir,
p_vout->p_vlc->psz_homedir );
free( p_mypicturesdir );
}
}
#else
if( !val.psz_string && p_vout->p_vlc->psz_homedir )
{
......
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