eliminate the dupe copies of things in smpackage (registry, RageUtil) and share some of the directory logic
This commit is contained in:
@@ -7,7 +7,13 @@
|
||||
namespace RegistryAccess
|
||||
{
|
||||
bool GetRegValue( const CString &key, const CString &sName, CString &val );
|
||||
bool GetRegValue( const CString &key, CString sName, int &val );
|
||||
bool GetRegValue( const CString &key, const CString &sName, int &val );
|
||||
bool GetRegValue( const CString &key, const CString &sName, bool &val );
|
||||
|
||||
bool SetRegValue( const CString &key, const CString &sName, const CString &val );
|
||||
bool SetRegValue( const CString &key, const CString &sName, int val );
|
||||
bool SetRegValue( const CString &key, const CString &sName, bool val );
|
||||
|
||||
bool GetRegSubKeys( const CString &key, vector<CString> &lst, const CString ®ex = ".*", bool bReturnPathToo = true );
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
#include "global.h"
|
||||
#include "SpecialDirs.h"
|
||||
#include "RegistryAccess.h"
|
||||
#include <shlobj.h>
|
||||
|
||||
CString GetMyDocumentsDir()
|
||||
{
|
||||
CString sMyDocumentsDir;
|
||||
bool bSuccess = RegistryAccess::GetRegValue( "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Personal", sMyDocumentsDir );
|
||||
ASSERT( bSuccess );
|
||||
sMyDocumentsDir.Replace( '\\', '/' );
|
||||
sMyDocumentsDir += "/";
|
||||
return sMyDocumentsDir;
|
||||
}
|
||||
|
||||
CString GetApplicationDataDir()
|
||||
{
|
||||
CString sApplicationDataDir;
|
||||
TCHAR szDir[MAX_PATH] = "";
|
||||
BOOL bResult = SHGetSpecialFolderPath( NULL, szDir, CSIDL_APPDATA, FALSE );
|
||||
ASSERT( bResult );
|
||||
sApplicationDataDir = szDir;
|
||||
sApplicationDataDir += "/";
|
||||
return sApplicationDataDir;
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2002-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef SpecialDirs_H
|
||||
#define SpecialDirs_H
|
||||
|
||||
CString GetMyDocumentsDir();
|
||||
CString GetApplicationDataDir();
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2002-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
Reference in New Issue
Block a user