mirror of
https://github.com/taurusxin/ncmdump.git
synced 2026-10-02 17:38:06 +08:00
fix: cannot recognize non-ASCII file name on Windows
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#include <vector>
|
||||
#include <filesystem>
|
||||
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
@@ -47,13 +47,13 @@ void processFilesInFolder(const fs::path& folderPath) {
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
int wmain(int argc, wchar_t* argv[])
|
||||
#else
|
||||
int main(int argc, char **argv)
|
||||
#endif
|
||||
{
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
#if defined(_WIN32) && defined(__MINGW64__)
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
#endif
|
||||
|
||||
@@ -67,7 +67,7 @@ int main(int argc, char **argv)
|
||||
|
||||
bool folderProvided = false;
|
||||
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
#define COMPARE_STR(s1, s2) (wcscmp(s1, s2) == 0)
|
||||
#define HELP_SHORT L"-h"
|
||||
#define HELP_LONG L"--help"
|
||||
@@ -95,11 +95,9 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
int multiByteStrSize = WideCharToMultiByte(CP_UTF8, 0, argv[1], -1, NULL, 0, NULL, NULL);
|
||||
char *multiByteStr = new char[multiByteStrSize];
|
||||
WideCharToMultiByte(CP_UTF8, 0, argv[i], -1, multiByteStr, multiByteStrSize, NULL, NULL);
|
||||
fs::path path(multiByteStr);
|
||||
#if defined(_WIN32)
|
||||
std::wstring wFilePath(argv[i]);
|
||||
fs::path path(wFilePath);
|
||||
#else
|
||||
fs::path path(argv[i]);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user