Remove unused function.

This commit is contained in:
halx99 2019-11-27 14:44:30 +08:00
parent 2a6cda73d7
commit d716d9511e
3 changed files with 7 additions and 33 deletions

View File

@ -231,11 +231,11 @@ void FileUtilsWin32::listFilesRecursively(const std::string& dirPath, std::vecto
// Error getting file
break;
}
std::string fileName = StringWideCharToChar(file.name);
std::string fileName = StringWideCharToMultiByte(file.name);
if (fileName != "." && fileName != "..")
{
std::string filepath = StringWideCharToChar(file.path);
std::string filepath = StringWideCharToMultiByte(file.path);
if (file.is_dir)
{
filepath.push_back('/');
@ -289,7 +289,7 @@ std::vector<std::string> FileUtilsWin32::listFiles(const std::string& dirPath) c
break;
}
std::string filepath = StringWideCharToChar(file.path);
std::string filepath = StringWideCharToMultiByte(file.path);
if (file.is_dir)
{
filepath.push_back('/');
@ -359,7 +359,7 @@ string FileUtilsWin32::getWritablePath() const
retPath = retPath.substr(0, retPath.rfind(L"\\") + 1);
}
return convertPathFormatToUnixStyle(StringWideCharToChar(retPath));
return convertPathFormatToUnixStyle(StringWideCharToMultiByte(retPath));
}
bool FileUtilsWin32::renameFile(const std::string &oldfullpath, const std::string& newfullpath) const
@ -444,7 +444,7 @@ bool FileUtilsWin32::createDirectory(const std::string& dirPath) const
{
subpath += dirs[i];
std::string utf8Path = StringWideCharToChar(subpath);
std::string utf8Path = StringWideCharToMultiByte(subpath);
if (!isDirectoryExist(utf8Path))
{
BOOL ret = CreateDirectory(subpath.c_str(), NULL);
@ -500,7 +500,7 @@ bool FileUtilsWin32::removeDirectory(const std::string& dirPath) const
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
temp += '/';
ret = ret && this->removeDirectory(StringWideCharToChar(temp));
ret = ret && this->removeDirectory(StringWideCharToMultiByte(temp));
}
else
{

View File

@ -55,31 +55,6 @@ std::wstring StringUtf8ToWideChar(const std::string& strUtf8)
return ret;
}
std::string StringWideCharToUtf8(const std::wstring& strWideChar)
{
std::string ret;
if (!strWideChar.empty())
{
int nNum = WideCharToMultiByte(CP_UTF8, 0, strWideChar.c_str(), -1, nullptr, 0, nullptr, FALSE);
if (nNum)
{
char* utf8String = new char[nNum + 1];
utf8String[0] = 0;
nNum = WideCharToMultiByte(CP_UTF8, 0, strWideChar.c_str(), -1, utf8String, nNum + 1, nullptr, FALSE);
ret = utf8String;
delete[] utf8String;
}
else
{
CCLOG("Wrong convert to Utf8 code:0x%x", GetLastError());
}
}
return ret;
}
std::string StringWideCharToMultiByte(const std::wstring& strWideChar, unsigned int cp)
{
int cchMultiByte = WideCharToMultiByte(cp, 0, strWideChar.c_str(), static_cast<int>(strWideChar.length()), NULL, 0, NULL, NULL);

View File

@ -32,8 +32,7 @@ THE SOFTWARE.
NS_CC_BEGIN
std::wstring CC_DLL StringUtf8ToWideChar(const std::string& strUtf8);
std::string CC_DLL StringWideCharToUtf8(const std::wstring& strWideChar);
std::string CC_DLL StringWideCharToChar(const std::wstring& strWideChar, unsigned int cp = CP_ACP);
std::string CC_DLL StringWideCharToMultiByte(const std::wstring& strWideChar, unsigned int cp = CP_ACP);
std::string CC_DLL UTF8StringToMultiByte(const std::string& strUtf8);
NS_CC_END