Skip to content
Discussion options

You must be logged in to vote

@Jarod42 found the solution:
(don't know if this is the right way of doing this but it works)

function project.files(prj)
	local files = {}

	for _, block in ipairs(prj._cfgset.blocks) do
		if block.files then
			for _, file in ipairs(block.files) do
				table.insert(files, path.getrelative(prj.basedir, file))
			end
		end
	end

	p.w('"files":[')
	p.indent("  ", 2)
	--manually add the concat part
	p.w('"' .. table.concat(files, '",\n		"') .. '"')

	p.indent("  ", 1)

	p.w('],')
	
end

wich gives this:

{
  "name":"ProjectName",
  "kind":"ConsoleApp",
  "language":"C",
  "files":[
    "src/**.c",
		"include/**.h"
  ],
  "configurations":
    {
      "Debug":{
      },
      "Release":{
     …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@lolrobbe2
Comment options

@lolrobbe2
Comment options

Answer selected by lolrobbe2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants