Skip to content

Commit 959bf9a

Browse files
committed
d2x: update version from 0.1.1 to 0.1.2 and add auto detect language feature
- mcpp-community/OpenOrg#1 Signed-off-by: sunrisepeak <speakshen@163.com>
1 parent c364252 commit 959bf9a

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

d2x/buildtools/xmake/main.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@ function main()
3232
os.cd(os.projectdir())
3333
--print("project file: " .. project.rootfile())
3434

35-
if command == "list" then
35+
if command == "init" then
36+
local d2x_json_file = path.join(os.projectdir(), ".d2x.json")
37+
if os.isfile(d2x_json_file) then
38+
local d2x_config = json.loadfile(d2x_json_file) or {}
39+
if d2x_config["lang"] then
40+
os.exec("xmake f --lang=" .. d2x_config["lang"])
41+
end
42+
end
43+
elseif command == "list" then
3644
list()
3745
elseif command == "build" then
3846
os.exec("xmake build " .. (target or ""))

dslings/xmake.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ if is_host("windows") then
44
add_ldflags("-static")
55
end
66

7-
local lang = "en"
8-
if d2x and d2x.private and d2x.private.mcpp then
9-
lang = d2x.private.mcpp.lang or "en"
10-
end
7+
option("lang")
8+
set_default("en")
9+
set_description("Language: en or zh")
10+
11+
local lang = get_config("lang")
1112

1213
if lang == "zh" then
1314

0 commit comments

Comments
 (0)