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 "archutils/Win32/SpecialDirs.h"
|
||||||
#include "ProductInfo.h"
|
#include "ProductInfo.h"
|
||||||
#include "RageFileManager.h"
|
#include "RageFileManager.h"
|
||||||
|
#include "SpecialFiles.h"
|
||||||
|
|
||||||
// for timeGetTime
|
// for timeGetTime
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@@ -51,13 +52,15 @@ void ArchHooks::MountInitialFilesystems( const RString &sDirOfExecutable )
|
|||||||
|
|
||||||
FILEMAN->Mount( "dir", sDir, "/" );
|
FILEMAN->Mount( "dir", sDir, "/" );
|
||||||
|
|
||||||
RString sMyDocumentsDir = SpecialDirs::GetMyDocumentsDir();
|
|
||||||
|
|
||||||
// Mount everything game-writable (not counting the editor) to the user's directory.
|
// Mount everything game-writable (not counting the editor) to the user's directory.
|
||||||
FILEMAN->Mount( "dir", sMyDocumentsDir + PRODUCT_ID + "/Cache", "/Cache" );
|
RString sAppDataDir = SpecialDirs::GetAppDataDir();
|
||||||
FILEMAN->Mount( "dir", sMyDocumentsDir + PRODUCT_ID + "/Logs", "/Logs" );
|
FILEMAN->Mount( "dir", sAppDataDir + PRODUCT_ID + "/Cache", "/Cache" );
|
||||||
FILEMAN->Mount( "dir", sMyDocumentsDir + PRODUCT_ID + "/Save", "/Save" );
|
FILEMAN->Mount( "dir", sAppDataDir + PRODUCT_ID + "/Logs", "/Logs" );
|
||||||
FILEMAN->Mount( "dir", sMyDocumentsDir + PRODUCT_ID + "/Screenshots", "/Screenshots" );
|
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 )
|
static RString LangIdToString( LANGID l )
|
||||||
|
|||||||
@@ -138,8 +138,8 @@ static BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
|
|||||||
STARTUPINFO si;
|
STARTUPINFO si;
|
||||||
ZeroMemory( &si, sizeof(si) );
|
ZeroMemory( &si, sizeof(si) );
|
||||||
|
|
||||||
RString sMyDocumentsDir = SpecialDirs::GetMyDocumentsDir();
|
RString sAppDataDir = SpecialDirs::GetAppDataDir();
|
||||||
RString sCommand = "notepad \"" + sMyDocumentsDir + PRODUCT_ID + "/Logs/log.txt\"";
|
RString sCommand = "notepad \"" + sAppDataDir + PRODUCT_ID + "/Logs/log.txt\"";
|
||||||
CreateProcess(
|
CreateProcess(
|
||||||
NULL, // pointer to name of executable module
|
NULL, // pointer to name of executable module
|
||||||
sCommand.GetBuffer(), // pointer to command line string
|
sCommand.GetBuffer(), // pointer to command line string
|
||||||
|
|||||||
@@ -1,29 +1,32 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "SpecialDirs.h"
|
#include "SpecialDirs.h"
|
||||||
#include "RegistryAccess.h"
|
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
|
|
||||||
RString SpecialDirs::GetMyDocumentsDir()
|
static RString GetSpecialFolderPath( int csidl )
|
||||||
{
|
|
||||||
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()
|
|
||||||
{
|
{
|
||||||
RString sDir;
|
RString sDir;
|
||||||
TCHAR szDir[MAX_PATH] = "";
|
TCHAR szDir[MAX_PATH] = "";
|
||||||
BOOL bResult = SHGetSpecialFolderPath( NULL, szDir, CSIDL_DESKTOP, FALSE );
|
BOOL bResult = SHGetSpecialFolderPath( NULL, szDir, csidl, FALSE );
|
||||||
ASSERT( bResult );
|
ASSERT( bResult );
|
||||||
sDir = szDir;
|
sDir = szDir;
|
||||||
sDir += "/";
|
sDir += "/";
|
||||||
return 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
|
namespace SpecialDirs
|
||||||
{
|
{
|
||||||
RString GetMyDocumentsDir();
|
RString GetAppDataDir();
|
||||||
RString GetDesktopDir();
|
RString GetDesktopDir();
|
||||||
|
RString GetPicturesDir();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user