feat: add MSVC CI; remove Makefile (#9)

Co-authored-by: TaurusXin <i@taurusxin.com>
This commit is contained in:
overwriter
2024-02-08 10:26:53 +08:00
committed by GitHub
co-authored by TaurusXin
parent 8185c430ee
commit 29273ff86f
4 changed files with 55 additions and 66 deletions
+19 -19
View File
@@ -5,7 +5,7 @@
#include <vector>
#include <filesystem>
#ifdef _WIN32
#if defined(_WIN32) && defined(_MSC_VER)
#include <Windows.h>
#endif
@@ -47,15 +47,15 @@ void processFilesInFolder(const fs::path& folderPath) {
}
}
#ifdef _WIN32
#if defined(_WIN32) && defined(_MSC_VER)
int wmain(int argc, wchar_t* argv[])
#else
int main(int argc, char **argv)
#endif
{
#ifdef _WIN32
SetConsoleOutputCP(CP_UTF8);
#endif
#if defined(_WIN32) && defined(_MSC_VER)
SetConsoleOutputCP(CP_UTF8);
#endif
if (argc <= 1) {
displayHelp();
@@ -67,17 +67,17 @@ int main(int argc, char **argv)
bool folderProvided = false;
#ifdef _WIN32
#define COMPARE_STR(s1, s2) (wcscmp(s1, s2) == 0)
#define HELP_SHORT L"-h"
#define HELP_LONG L"--help"
#define FOLDER L"-d"
#else
#define COMPARE_STR(s1, s2) (strcmp(s1, s2) == 0)
#define HELP_SHORT "-h"
#define HELP_LONG "--help"
#define FOLDER "-d"
#endif
#if defined(_WIN32) && defined(_MSC_VER)
#define COMPARE_STR(s1, s2) (wcscmp(s1, s2) == 0)
#define HELP_SHORT L"-h"
#define HELP_LONG L"--help"
#define FOLDER L"-d"
#else
#define COMPARE_STR(s1, s2) (strcmp(s1, s2) == 0)
#define HELP_SHORT "-h"
#define HELP_LONG "--help"
#define FOLDER "-d"
#endif
for (int i = 1; i < argc; ++i) {
if (COMPARE_STR(argv[i], HELP_SHORT) || COMPARE_STR(argv[i], HELP_LONG)) {
@@ -95,14 +95,14 @@ int main(int argc, char **argv)
return 1;
}
} else {
#ifdef _WIN32
#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);
#else
#else
fs::path path(argv[i]);
#endif
#endif
files.push_back(path);
}
}