fix: parse UTF-8 path to lib
This commit is contained in:
parent
dbdb73c120
commit
321e5f342e
|
@ -19,20 +19,21 @@ FILE(GLOB COMMON_SOURCES src/ncmcrypt.cpp src/utils/*.cpp)
|
||||||
FILE(GLOB EXECUTABLE_SOURCES src/main.cpp)
|
FILE(GLOB EXECUTABLE_SOURCES src/main.cpp)
|
||||||
FILE(GLOB LIBRARY_HEADERS src/lib/libncmdump.h)
|
FILE(GLOB LIBRARY_HEADERS src/lib/libncmdump.h)
|
||||||
FILE(GLOB LIBRARY_SOURCES src/lib/*.cpp)
|
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)
|
if(WIN32)
|
||||||
add_executable(ncmdump_exec
|
add_executable(ncmdump_exec
|
||||||
${COMMON_HEADERS}
|
${COMMON_HEADERS}
|
||||||
${COMMON_SOURCES}
|
${COMMON_SOURCES}
|
||||||
${EXECUTABLE_SOURCES}
|
${EXECUTABLE_SOURCES}
|
||||||
${WIN_EXEC_SOURCES}
|
${WIN_SOURCES}
|
||||||
)
|
)
|
||||||
add_library(ncmdump_lib SHARED
|
add_library(ncmdump_lib SHARED
|
||||||
${COMMON_HEADERS}
|
${COMMON_HEADERS}
|
||||||
${COMMON_SOURCES}
|
${COMMON_SOURCES}
|
||||||
${LIBRARY_HEADERS}
|
${LIBRARY_HEADERS}
|
||||||
${LIBRARY_SOURCES}
|
${LIBRARY_SOURCES}
|
||||||
|
${WIN_SOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(ncmdump_lib PROPERTIES OUTPUT_NAME "libncmdump")
|
set_target_properties(ncmdump_lib PROPERTIES OUTPUT_NAME "libncmdump")
|
||||||
|
|
|
@ -1,27 +1,31 @@
|
||||||
#include "libncmdump.h"
|
#include "libncmdump.h"
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
API NeteaseCrypt* CreateNeteaseCrypt(const char* path) {
|
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) {
|
API int Dump(NeteaseCrypt* neteaseCrypt) {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
neteaseCrypt->Dump();
|
neteaseCrypt->Dump();
|
||||||
}
|
}
|
||||||
catch (const std::invalid_argument& e)
|
catch (const std::invalid_argument& e)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
API void FixMetadata(NeteaseCrypt* neteaseCrypt) {
|
API void FixMetadata(NeteaseCrypt* neteaseCrypt) {
|
||||||
neteaseCrypt->FixMetadata();
|
neteaseCrypt->FixMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
API void DestroyNeteaseCrypt(NeteaseCrypt* neteaseCrypt) {
|
API void DestroyNeteaseCrypt(NeteaseCrypt* neteaseCrypt) {
|
||||||
delete neteaseCrypt;
|
delete neteaseCrypt;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue