fix: parse UTF-8 path to lib

This commit is contained in:
TaurusXin 2024-04-06 12:09:03 +08:00
parent dbdb73c120
commit 321e5f342e
Signed by: taurusxin
GPG Key ID: C334DCA04AC2D2CC
2 changed files with 27 additions and 22 deletions

View File

@ -19,20 +19,21 @@ FILE(GLOB COMMON_SOURCES src/ncmcrypt.cpp src/utils/*.cpp)
FILE(GLOB EXECUTABLE_SOURCES src/main.cpp)
FILE(GLOB LIBRARY_HEADERS src/lib/libncmdump.h)
FILE(GLOB LIBRARY_SOURCES src/lib/*.cpp)
FILE(GLOB WIN_EXEC_SOURCES src/platform/win32_init.cpp)
FILE(GLOB WIN_SOURCES src/platform/win32_init.cpp)
if(WIN32)
add_executable(ncmdump_exec
${COMMON_HEADERS}
${COMMON_SOURCES}
${EXECUTABLE_SOURCES}
${WIN_EXEC_SOURCES}
${WIN_SOURCES}
)
add_library(ncmdump_lib SHARED
${COMMON_HEADERS}
${COMMON_SOURCES}
${LIBRARY_HEADERS}
${LIBRARY_SOURCES}
${WIN_SOURCES}
)
set_target_properties(ncmdump_lib PROPERTIES OUTPUT_NAME "libncmdump")

View File

@ -1,8 +1,12 @@
#include "libncmdump.h"
#include <filesystem>
namespace fs = std::filesystem;
extern "C" {
API NeteaseCrypt* CreateNeteaseCrypt(const char* path) {
return new NeteaseCrypt(std::string(path));
fs::path fPath = fs::u8path(path);
return new NeteaseCrypt(fPath.u8string());
}
API int Dump(NeteaseCrypt* neteaseCrypt) {