Defaults.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include "main.h"
  2. #include "Defaults.h"
  3. #include <shlobj.h>
  4. wchar_t defaultDownloadPath[MAX_PATH] = {0},
  5. serviceUrl[1024] = {0};
  6. __time64_t updateTime = 60 /* 1 minute */ * 60 /* 1 hour */ * 24 /* 1 day */;
  7. int autoDownloadEpisodes = 1;
  8. bool autoUpdate = true;
  9. bool autoDownload = true;
  10. bool updateOnLaunch = false;
  11. bool needToMakePodcastsView=true;
  12. static BOOL UtilGetSpecialFolderPath( HWND hwnd, wchar_t *path, int folder )
  13. {
  14. ITEMIDLIST *pidl; // Shell Item ID List ptr
  15. IMalloc *imalloc; // Shell IMalloc interface ptr
  16. BOOL result; // Return value
  17. if ( SHGetSpecialFolderLocation( hwnd, folder, &pidl ) != NOERROR )
  18. return FALSE;
  19. result = SHGetPathFromIDList( pidl, path );
  20. if ( SHGetMalloc( &imalloc ) == NOERROR )
  21. {
  22. imalloc->Free( pidl );
  23. imalloc->Release();
  24. }
  25. return result;
  26. }
  27. void BuildDefaultDownloadPath( HWND hwnd )
  28. {
  29. wchar_t defaultPath[ MAX_PATH ] = L"";
  30. if ( !UtilGetSpecialFolderPath( hwnd, defaultPath, CSIDL_MYMUSIC ) )
  31. UtilGetSpecialFolderPath( hwnd, defaultPath, CSIDL_PERSONAL );
  32. lstrcpyn( defaultDownloadPath, defaultPath, MAX_PATH );
  33. }