Skip to content

Commit

Permalink
适配window使用加密
Browse files Browse the repository at this point in the history
  • Loading branch information
huahua132 committed Nov 18, 2024
1 parent 625de1b commit 4a5463e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows")

# 生成lua.exe
add_executable(lua skynet/3rd/lua/lua.c)
target_link_libraries(lua liblua)
target_link_libraries(lua liblua ws2_32 libposix)

# 定义复制目标
add_custom_command(TARGET liblua POST_BUILD
Expand Down Expand Up @@ -114,7 +114,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows")
# 生成动态库 client.so
add_library(client SHARED skynet/lualib-src/lua-crypt.c skynet/lualib-src/lsha1.c)
target_include_directories(client PRIVATE skynet/skynet-src)
target_link_libraries(client liblua)
target_link_libraries(client liblua ws2_32 libposix)

# 生成动态库 sproto.so
aux_source_directory(skynet/lualib-src/sproto SPROTO_SRC)
Expand Down
11 changes: 8 additions & 3 deletions script/lua/encrycode.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ for file_name, file_path, file_info in file_util.diripairs('./') do
if not isok then
print("create dir_path err ", dir_path, err)
else
local newfile = io.open(new_path, "w+")
local newfile = io.open(new_path, "w+b")
if not newfile then
print("can`t openfile >>> ", new_path)
else
Expand All @@ -61,8 +61,13 @@ for file_name, file_path, file_info in file_util.diripairs('./') do
newfile:write(size)
newfile:write(encode_str)
newfile:close()
print("encry file succ:", new_path, #encode_str)
loadfile(new_path) --测试加载

local func,err = loadfile(new_path) --测试加载
if not func then
print("loadfile err ", err)
else
print("encry file succ:", new_path, #encode_str)
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion skynet
Submodule skynet updated 1 files
+14 −12 3rd/lua/lauxlib.c

0 comments on commit 4a5463e

Please sign in to comment.