The themes are now copied to the %APPDATA% on first run.

Few changes to the Enigma skin to make it work better in different resolutions.
This commit is contained in:
Kimmo Pekkola 2009-08-01 16:40:04 +00:00
parent b6954bcdd0
commit 3c0923f862
3 changed files with 41 additions and 18 deletions

View File

@ -290,7 +290,7 @@
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
CommandLine="if not exist ..\testbench\x32\debug\skins (mkdir ..\testbench\x32\debug\skins)&#x0D;&#x0A;echo &quot;Copying the skins...&quot;&#x0D;&#x0A;xcopy /Q /S /Y ..\Install\Skins ..\testbench\x32\debug\skins&#x0D;&#x0A;" CommandLine="if not exist ..\testbench\x32\debug\skins (mkdir ..\testbench\x32\debug\skins)&#x0D;&#x0A;if not exist ..\testbench\x32\debug\themes (mkdir ..\testbench\x32\debug\themes)&#x0D;&#x0A;echo &quot;Copying the skins...&quot;&#x0D;&#x0A;xcopy /Q /S /Y ..\Install\Skins ..\testbench\x32\debug\skins&#x0D;&#x0A;xcopy /Q /S /Y ..\Install\Themes ..\testbench\x32\debug\themes&#x0D;&#x0A;xcopy /Q /S /Y ..\Install\Default.ini ..\testbench\x32\debug\"
/> />
</Configuration> </Configuration>
<Configuration <Configuration
@ -476,7 +476,7 @@
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
CommandLine="if not exist ..\testbench\x32\release\skins (mkdir ..\testbench\x32\release\skins)&#x0D;&#x0A;echo &quot;Copying the skins...&quot;&#x0D;&#x0A;xcopy /Q /S /Y ..\Install\Skins ..\testbench\x32\release\skins&#x0D;&#x0A;" CommandLine="if not exist ..\testbench\x32\release\skins (mkdir ..\testbench\x32\release\skins)&#x0D;&#x0A;if not exist ..\testbench\x32\release\themes (mkdir ..\testbench\x32\release\themes)&#x0D;&#x0A;echo &quot;Copying the skins...&quot;&#x0D;&#x0A;xcopy /Q /S /Y ..\Install\Skins ..\testbench\x32\release\skins&#x0D;&#x0A;xcopy /Q /S /Y ..\Install\Themes ..\testbench\x32\release\themes&#x0D;&#x0A;xcopy /Q /S /Y ..\Install\Default.ini ..\testbench\x32release\"
/> />
</Configuration> </Configuration>
<Configuration <Configuration

View File

@ -750,24 +750,18 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
// Copy the default skin to the Skins folder // Copy the default skin to the Skins folder
std::wstring strFrom(m_Path + L"Skins\\" + L"*.*"); std::wstring strFrom(m_Path + L"Skins\\" + L"*.*");
std::wstring strTo(m_SkinPath); std::wstring strTo(m_SkinPath);
CopyFiles(strFrom, strTo);
// The strings must end with double nul // This shouldn't be copied
strFrom.append(L"0"); std::wstring strNote = strTo + L"Read me before copying skins to here.txt";
strFrom[strFrom.size() - 1] = L'\0'; DeleteFile(strNote.c_str());
strTo.append(L"0");
strTo[strTo.size() - 1] = L'\0';
SHFILEOPSTRUCT fo = {0}; // Copy also the themes to the %APPDATA%
fo.wFunc = FO_COPY; strFrom = std::wstring(m_Path + L"Themes\\" + L"*.*");
fo.pFrom = strFrom.c_str(); strTo = std::wstring(GetSettingsPath() + L"Themes");
fo.pTo = strTo.c_str(); CreateDirectory(strTo.c_str(), NULL);
fo.fFlags = FOF_NO_UI; strTo += L"\\";
CopyFiles(strFrom, strTo);
int result = SHFileOperation(&fo);
if (result != 0)
{
DebugLog(L"Unable to copy the default skin %i", result);
}
} }
} }
else else
@ -900,6 +894,34 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
return Result; // Alles OK return Result; // Alles OK
} }
/*
** CopyFiles
**
** Copies files and folders from one location to another.
**
*/
void CRainmeter::CopyFiles(std::wstring strFrom, std::wstring strTo)
{
// The strings must end with double nul
strFrom.append(L"0");
strFrom[strFrom.size() - 1] = L'\0';
strTo.append(L"0");
strTo[strTo.size() - 1] = L'\0';
SHFILEOPSTRUCT fo = {0};
fo.wFunc = FO_COPY;
fo.pFrom = strFrom.c_str();
fo.pTo = strTo.c_str();
fo.fFlags = FOF_NO_UI;
int result = SHFileOperation(&fo);
if (result != 0)
{
DebugLog(L"Unable to copy files from %s to %s (%i)", strFrom.c_str(), strTo.c_str(), result);
}
}
/* /*
** CreateDefaultConfigFile ** CreateDefaultConfigFile
** **

View File

@ -175,6 +175,7 @@ private:
HMENU CreateConfigMenu(std::vector<CONFIGMENU>& configMenuData); HMENU CreateConfigMenu(std::vector<CONFIGMENU>& configMenuData);
void CreateDefaultConfigFile(std::wstring strFile); void CreateDefaultConfigFile(std::wstring strFile);
void TestSettingsFile(bool bDefaultIniLocation); void TestSettingsFile(bool bDefaultIniLocation);
void CopyFiles(std::wstring strFrom, std::wstring strTo);
CTrayWindow* m_TrayWindow; CTrayWindow* m_TrayWindow;