Changeset d73e233da15e73a662807b43b44e034fd74429bd

Show
Ignore:
Timestamp:
05/05/08 22:34:21 (4 months ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1210019661 +0300
git-parent:

[e7125f4ec9d298e514b56f721ebac2a7be14b24a]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1210016531 +0300
Message:

Simplify Win32 GetDir?, and use the proper header files

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/config/core.c

    re7125f4 rd73e233  
    2626#endif 
    2727 
     28#if defined( WIN32 ) 
     29#   if !defined( UNDER_CE ) 
     30#       define _WIN32_IE IE5 
     31#       include <w32api.h> 
     32#       include <direct.h> 
     33#       include <shlobj.h> 
     34#   endif 
     35#   include <tchar.h> 
     36#endif 
     37 
    2838#include <vlc/vlc.h> 
    2939#include "../libvlc.h" 
     
    4959#if defined( HAVE_SYS_TYPES_H ) 
    5060#   include <sys/types.h> 
    51 #endif 
    52 #if defined( WIN32 ) 
    53 #   if !defined( UNDER_CE ) 
    54 #       include <direct.h> 
    55 #   endif 
    56 #include <tchar.h> 
    5761#endif 
    5862 
     
    623627 
    624628#if defined(WIN32) && !defined(UNDER_CE) 
    625     typedef HRESULT (WINAPI *SHGETFOLDERPATH)( HWND, int, HANDLE, DWORD, 
    626                                                LPWSTR ); 
    627 #ifndef CSIDL_FLAG_CREATE 
    628 #   define CSIDL_FLAG_CREATE 0x8000 
    629 #endif 
    630 #ifndef CSIDL_APPDATA 
    631 #   define CSIDL_APPDATA 0x1A 
    632 #endif 
    633 #ifndef CSIDL_PROFILE 
    634 #   define CSIDL_PROFILE 0x28 
    635 #endif 
    636 #ifndef SHGFP_TYPE_CURRENT 
    637 #   define SHGFP_TYPE_CURRENT 0 
    638 #endif 
    639  
    640     HINSTANCE shfolder_dll; 
    641     SHGETFOLDERPATH SHGetFolderPath ; 
    642  
    643     /* load the shfolder dll to retrieve SHGetFolderPath */ 
    644     if( ( shfolder_dll = LoadLibrary( _T("SHFolder.dll") ) ) != NULL ) 
    645     { 
    646         SHGetFolderPath = (void *)GetProcAddress( shfolder_dll, 
    647                                                   _T("SHGetFolderPathW") ); 
    648         if ( SHGetFolderPath != NULL ) 
    649         { 
    650             wchar_t whomedir[MAX_PATH]; 
    651  
    652             /* get the "Application Data" folder for the current user */ 
    653             if( S_OK == SHGetFolderPath( NULL, 
    654                                          (b_appdata ? CSIDL_APPDATA : 
    655                                            CSIDL_PROFILE) | CSIDL_FLAG_CREATE, 
    656                                          NULL, SHGFP_TYPE_CURRENT, 
    657                                          whomedir ) ) 
    658             { 
    659                 FreeLibrary( shfolder_dll ); 
    660                 return FromWide( whomedir ); 
    661             } 
    662         } 
    663         FreeLibrary( shfolder_dll ); 
    664     } 
     629    wchar_t whomedir[MAX_PATH]; 
     630    /* Get the "Application Data" folder for the current user */ 
     631    if( S_OK == SHGetFolderPathW( NULL, 
     632              (b_appdata ? CSIDL_APPDATA : CSIDL_PROFILE) | CSIDL_FLAG_CREATE, 
     633                                  NULL, SHGFP_TYPE_CURRENT, whomedir ) ) 
     634        return FromWide( whomedir ); 
    665635 
    666636#elif defined(UNDER_CE)