Windows: save files in AppData dir (not MyDocuments), save Screenshots in user's Pictures dir
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "archutils/Win32/SpecialDirs.h"
|
||||
#include "ProductInfo.h"
|
||||
#include "RageFileManager.h"
|
||||
#include "SpecialFiles.h"
|
||||
|
||||
// for timeGetTime
|
||||
#include <windows.h>
|
||||
@@ -51,13 +52,15 @@ void ArchHooks::MountInitialFilesystems( const RString &sDirOfExecutable )
|
||||
|
||||
FILEMAN->Mount( "dir", sDir, "/" );
|
||||
|
||||
RString sMyDocumentsDir = SpecialDirs::GetMyDocumentsDir();
|
||||
|
||||
// Mount everything game-writable (not counting the editor) to the user's directory.
|
||||
FILEMAN->Mount( "dir", sMyDocumentsDir + PRODUCT_ID + "/Cache", "/Cache" );
|
||||
FILEMAN->Mount( "dir", sMyDocumentsDir + PRODUCT_ID + "/Logs", "/Logs" );
|
||||
FILEMAN->Mount( "dir", sMyDocumentsDir + PRODUCT_ID + "/Save", "/Save" );
|
||||
FILEMAN->Mount( "dir", sMyDocumentsDir + PRODUCT_ID + "/Screenshots", "/Screenshots" );
|
||||
RString sAppDataDir = SpecialDirs::GetAppDataDir();
|
||||
FILEMAN->Mount( "dir", sAppDataDir + PRODUCT_ID + "/Cache", "/Cache" );
|
||||
FILEMAN->Mount( "dir", sAppDataDir + PRODUCT_ID + "/Logs", "/Logs" );
|
||||
FILEMAN->Mount( "dir", sAppDataDir + PRODUCT_ID + "/Save", "/Save" );
|
||||
FILEMAN->Mount( "dir", sAppDataDir + PRODUCT_ID + "/Packages", "/" + SpecialFiles::USER_PACKAGES_DIR );
|
||||
|
||||
RString sPicturesDir = SpecialDirs::GetPicturesDir();
|
||||
FILEMAN->Mount( "dir", sPicturesDir + PRODUCT_ID, "/Screenshots" );
|
||||
}
|
||||
|
||||
static RString LangIdToString( LANGID l )
|
||||
|
||||
@@ -138,8 +138,8 @@ static BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||
STARTUPINFO si;
|
||||
ZeroMemory( &si, sizeof(si) );
|
||||
|
||||
RString sMyDocumentsDir = SpecialDirs::GetMyDocumentsDir();
|
||||
RString sCommand = "notepad \"" + sMyDocumentsDir + PRODUCT_ID + "/Logs/log.txt\"";
|
||||
RString sAppDataDir = SpecialDirs::GetAppDataDir();
|
||||
RString sCommand = "notepad \"" + sAppDataDir + PRODUCT_ID + "/Logs/log.txt\"";
|
||||
CreateProcess(
|
||||
NULL, // pointer to name of executable module
|
||||
sCommand.GetBuffer(), // pointer to command line string
|
||||
|
||||
@@ -1,29 +1,32 @@
|
||||
#include "global.h"
|
||||
#include "SpecialDirs.h"
|
||||
#include "RegistryAccess.h"
|
||||
#include <shlobj.h>
|
||||
|
||||
RString SpecialDirs::GetMyDocumentsDir()
|
||||
{
|
||||
RString sMyDocumentsDir;
|
||||
bool bSuccess = RegistryAccess::GetRegValue( "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Personal", sMyDocumentsDir );
|
||||
ASSERT( bSuccess );
|
||||
sMyDocumentsDir.Replace( '\\', '/' );
|
||||
sMyDocumentsDir += "/";
|
||||
return sMyDocumentsDir;
|
||||
}
|
||||
|
||||
RString SpecialDirs::GetDesktopDir()
|
||||
static RString GetSpecialFolderPath( int csidl )
|
||||
{
|
||||
RString sDir;
|
||||
TCHAR szDir[MAX_PATH] = "";
|
||||
BOOL bResult = SHGetSpecialFolderPath( NULL, szDir, CSIDL_DESKTOP, FALSE );
|
||||
BOOL bResult = SHGetSpecialFolderPath( NULL, szDir, csidl, FALSE );
|
||||
ASSERT( bResult );
|
||||
sDir = szDir;
|
||||
sDir += "/";
|
||||
return sDir;
|
||||
}
|
||||
|
||||
RString SpecialDirs::GetAppDataDir()
|
||||
{
|
||||
return GetSpecialFolderPath( CSIDL_APPDATA );
|
||||
}
|
||||
|
||||
RString SpecialDirs::GetDesktopDir()
|
||||
{
|
||||
return GetSpecialFolderPath( CSIDL_DESKTOP );
|
||||
}
|
||||
|
||||
RString SpecialDirs::GetPicturesDir()
|
||||
{
|
||||
return GetSpecialFolderPath( CSIDL_MYPICTURES );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
|
||||
namespace SpecialDirs
|
||||
{
|
||||
RString GetMyDocumentsDir();
|
||||
RString GetAppDataDir();
|
||||
RString GetDesktopDir();
|
||||
RString GetPicturesDir();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user