mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Revert "SkinInstaller: Fix issues with paths containing Unicode characters"
This reverts commit 05c6ce1ce7
.
This commit is contained in:
parent
685eccfa9f
commit
c834e59bcd
@ -293,3 +293,37 @@ OSPLATFORM GetOSPlatform()
|
||||
|
||||
return OSPLATFORM_UNKNOWN;
|
||||
}
|
||||
|
||||
std::string ConvertToAscii(LPCTSTR str)
|
||||
{
|
||||
std::string szAscii;
|
||||
|
||||
if (str && *str)
|
||||
{
|
||||
int strLen = (int)wcslen(str);
|
||||
int bufLen = WideCharToMultiByte(CP_ACP, 0, str, strLen, NULL, 0, NULL, NULL);
|
||||
if (bufLen > 0)
|
||||
{
|
||||
szAscii.resize(bufLen);
|
||||
WideCharToMultiByte(CP_ACP, 0, str, strLen, &szAscii[0], bufLen, NULL, NULL);
|
||||
}
|
||||
}
|
||||
return szAscii;
|
||||
}
|
||||
|
||||
std::wstring ConvertToWide(LPCSTR str)
|
||||
{
|
||||
std::wstring szWide;
|
||||
|
||||
if (str && *str)
|
||||
{
|
||||
int strLen = (int)strlen(str);
|
||||
int bufLen = MultiByteToWideChar(CP_ACP, 0, str, strLen, NULL, 0);
|
||||
if (bufLen > 0)
|
||||
{
|
||||
szWide.resize(bufLen);
|
||||
MultiByteToWideChar(CP_ACP, 0, str, strLen, &szWide[0], bufLen);
|
||||
}
|
||||
}
|
||||
return szWide;
|
||||
}
|
@ -53,5 +53,7 @@ OSPLATFORM GetOSPlatform();
|
||||
|
||||
bool IsRunning(const WCHAR* name, HANDLE* hMutex);
|
||||
bool CopyFiles(const std::wstring& strFrom, const std::wstring& strTo, bool bMove = false);
|
||||
std::string ConvertToAscii(LPCTSTR str);
|
||||
std::wstring ConvertToWide(LPCSTR str);
|
||||
|
||||
#endif
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "DialogInstall.h"
|
||||
#include "../Library/pcre-8.10/config.h"
|
||||
#include "../Library/pcre-8.10/pcre.h"
|
||||
#include "../Common/StringUtil.h"
|
||||
#include "resource.h"
|
||||
#include "../Version.h"
|
||||
|
||||
@ -389,7 +388,7 @@ bool CDialogInstall::ReadPackage()
|
||||
return false;
|
||||
}
|
||||
|
||||
m_PackageUnzFile = unzOpen(StringUtil::NarrowUTF8(fileName).c_str());
|
||||
m_PackageUnzFile = unzOpen(ConvertToAscii(fileName).c_str());
|
||||
if (!m_PackageUnzFile)
|
||||
{
|
||||
return false;
|
||||
@ -410,7 +409,7 @@ bool CDialogInstall::ReadPackage()
|
||||
unz_file_info ufi;
|
||||
if (unzGetCurrentFileInfo(m_PackageUnzFile, &ufi, cBuffer, MAX_PATH, NULL, 0, NULL, 0) == UNZ_OK)
|
||||
{
|
||||
MultiByteToWideChar(CP_UTF8, 0, cBuffer, strlen(cBuffer) + 1, buffer, MAX_PATH);
|
||||
MultiByteToWideChar(CP_ACP, 0, cBuffer, strlen(cBuffer) + 1, buffer, MAX_PATH);
|
||||
while (WCHAR* pos = wcschr(buffer, L'/')) *pos = L'\\';
|
||||
return true;
|
||||
}
|
||||
@ -718,7 +717,7 @@ bool CDialogInstall::InstallPackage()
|
||||
unz_file_info ufi;
|
||||
if (unzGetCurrentFileInfo(m_PackageUnzFile, &ufi, cBuffer, MAX_PATH, NULL, 0, NULL, 0) == UNZ_OK)
|
||||
{
|
||||
MultiByteToWideChar(CP_UTF8, 0, cBuffer, strlen(cBuffer) + 1, buffer, MAX_PATH);
|
||||
MultiByteToWideChar(CP_ACP, 0, cBuffer, strlen(cBuffer) + 1, buffer, MAX_PATH);
|
||||
while (WCHAR* pos = wcschr(buffer, L'/')) *pos = L'\\';
|
||||
return true;
|
||||
}
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "Application.h"
|
||||
#include "DialogPackage.h"
|
||||
#include "DialogInstall.h"
|
||||
#include "../Common/StringUtil.h"
|
||||
#include "resource.h"
|
||||
#include "../Version.h"
|
||||
|
||||
@ -265,7 +264,7 @@ bool CDialogPackage::CreatePackage()
|
||||
WritePrivateProfileString(L"rmskin", L"MinimumWindows", m_MinimumWindows.c_str(), tempFile);
|
||||
|
||||
// Create archive and add options file and header bitmap
|
||||
m_ZipFile = zipOpen(StringUtil::NarrowUTF8(m_TargetFile).c_str(), APPEND_STATUS_CREATE);
|
||||
m_ZipFile = zipOpen(ConvertToAscii(m_TargetFile.c_str()).c_str(), APPEND_STATUS_CREATE);
|
||||
|
||||
auto cleanup = [&]()->bool
|
||||
{
|
||||
@ -380,16 +379,16 @@ unsigned __stdcall CDialogPackage::PackagerThreadProc(void* pParam)
|
||||
|
||||
bool CDialogPackage::AddFileToPackage(const WCHAR* filePath, const WCHAR* zipPath)
|
||||
{
|
||||
std::string zipPathUTF8 = StringUtil::NarrowUTF8(zipPath);
|
||||
for (int i = 0, isize = zipPathUTF8.length(); i < isize; ++i)
|
||||
std::string zipPathAscii = ConvertToAscii(zipPath);
|
||||
for (int i = 0, isize = zipPathAscii.length(); i < isize; ++i)
|
||||
{
|
||||
if (zipPathUTF8[i] == '\\')
|
||||
if (zipPathAscii[i] == '\\')
|
||||
{
|
||||
zipPathUTF8[i] = '/';
|
||||
zipPathAscii[i] = '/';
|
||||
}
|
||||
}
|
||||
|
||||
int open = zipOpenNewFileInZip(m_ZipFile, zipPathUTF8.c_str(), NULL, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
|
||||
int open = zipOpenNewFileInZip(m_ZipFile, zipPathAscii.c_str(), NULL, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
|
||||
if (open != ZIP_OK)
|
||||
{
|
||||
return false;
|
||||
@ -744,7 +743,7 @@ INT_PTR CALLBACK CDialogPackage::SelectPluginDlgProc(HWND hWnd, UINT uMsg, WPARA
|
||||
|
||||
bool x32 = LOWORD(wParam) == IDC_PACKAGESELECTPLUGIN_32BITBROWSE_BUTTON;
|
||||
|
||||
LOADED_IMAGE* loadedImage = ImageLoad(StringUtil::NarrowUTF8(buffer).c_str(), NULL);
|
||||
LOADED_IMAGE* loadedImage = ImageLoad(ConvertToAscii(buffer).c_str(), NULL);
|
||||
if (loadedImage)
|
||||
{
|
||||
WORD machine = loadedImage->FileHeader->FileHeader.Machine;
|
||||
|
@ -134,7 +134,6 @@
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Common\StringUtil.cpp" />
|
||||
<ClCompile Include="..\Library\Dialog.cpp" />
|
||||
<ClCompile Include="Application.cpp" />
|
||||
<ClCompile Include="DialogInstall.cpp" />
|
||||
@ -171,7 +170,6 @@
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Common\StringUtil.h" />
|
||||
<ClInclude Include="..\Library\Dialog.h" />
|
||||
<ClInclude Include="Application.h" />
|
||||
<ClInclude Include="DialogInstall.h" />
|
||||
|
@ -22,9 +22,6 @@
|
||||
<Filter Include="pcre">
|
||||
<UniqueIdentifier>{73cc243e-5b60-4fbc-ae48-069c6decc4ed}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Common">
|
||||
<UniqueIdentifier>{65d4ccc5-15bd-4268-a539-ebf090e28d5d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Application.cpp">
|
||||
@ -90,9 +87,6 @@
|
||||
<ClCompile Include="DialogPackage.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\StringUtil.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="resource.h">
|
||||
@ -161,9 +155,6 @@
|
||||
<ClInclude Include="DialogPackage.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\StringUtil.h">
|
||||
<Filter>Common</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Res\SkinInstaller.ico">
|
||||
|
Loading…
Reference in New Issue
Block a user