Skip to content

Commit 2566a7d

Browse files
committed
revert languages for template
1 parent bf24224 commit 2566a7d

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

xmake/actions/create/template.lua

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,19 @@ function replace_variables_in_files(files, vars)
139139
end
140140

141141
-- get all languages from templates
142-
--
143-
-- scanning template roots to detect languages is too slow, and the language module list does not fully match template language names,
144-
-- so we hardcode it here for better performance.
145142
function languages()
146-
return {"c", "c++", "cuda", "dlang", "fortran", "go",
147-
"kotlin", "nim", "objc", "objc++", "pascal",
148-
"rust", "swift", "vala", "zig"}
143+
local found = hashset.new()
144+
for _, rootdir in ipairs(rootdirs()) do
145+
local languages_dirs = os.dirs(path.join(rootdir, "*"))
146+
if languages_dirs then
147+
for _, d in ipairs(languages_dirs) do
148+
found:insert(path.filename(d))
149+
end
150+
end
151+
end
152+
local results = found:to_array()
153+
table.sort(results)
154+
return results
149155
end
150156

151157
-- get all templates for the given language

0 commit comments

Comments
 (0)