# # # patch "lua_hooks.cc" # from [2de8862b41118a47846e7e9da00b02a8c238b1aa] # to [4d00f0ed99d08e1f4f4797daea9be0100c6aa996] # # patch "luaext_platform.cc" # from [863e2fb4a78941f7db87c5df9706f2e6113ff247] # to [3b98afc36f9912e1782217446def6ef4c80bcc4a] # # patch "std_hooks.lua" # from [bc1dacac8e1a5ac2c3ee4026ebdb010a6d28c299] # to [afe481853aec4ec93c19717c7d81b7688fbe6ece] # # patch "tester.cc" # from [155bfd8706809100e1cff699c46c2c2f4d0a7049] # to [b628066507ab63cd5de7feb76bd83a10c0d08568] # ============================================================ --- lua_hooks.cc 2de8862b41118a47846e7e9da00b02a8c238b1aa +++ lua_hooks.cc 4d00f0ed99d08e1f4f4797daea9be0100c6aa996 @@ -528,8 +528,28 @@ lua_hooks::hook_get_projects(std::map const & project_definitions) +{ + Lua ll(st); + ll.func("write_projects"); + ll.push_table(); + for (std::map::const_iterator i = project_definitions.begin(); + i != project_definitions.end(); ++i) + { + ll.push_str(i->first); + ll.push_str(i->second()); + ll.set_table(); + } + bool ret; + ll.call(1, 0).extract_bool(ret); + return ret && ll.ok(); +} + + + bool lua_hooks::hook_merge3(file_path const & anc_path, file_path const & left_path, ============================================================ --- luaext_platform.cc 863e2fb4a78941f7db87c5df9706f2e6113ff247 +++ luaext_platform.cc 3b98afc36f9912e1782217446def6ef4c80bcc4a @@ -205,6 +205,22 @@ LUAEXT(isdir, ) return 1; } +LUAEXT(mkdir, ) +{ + try + { + char const * dirname = luaL_checkstring(LS, -1); + do_mkdir(dirname); + lua_pushboolean(LS, true); + return 1; + } + catch(recoverable_failure & e) + { + lua_pushnil(LS); + return 1; + } +} + namespace { struct build_table : public dirent_consumer ============================================================ --- std_hooks.lua bc1dacac8e1a5ac2c3ee4026ebdb010a6d28c299 +++ std_hooks.lua afe481853aec4ec93c19717c7d81b7688fbe6ece @@ -491,6 +491,21 @@ end return ret end +function write_projects(projects) + if get_confdir() == nil then return false end + local project_dir = get_confdir() .. "/projects" + if not isdir(project_dir) then mkdir(project_dir) end + + for name, contents in pairs(projects) do + local file = io.open(project_dir .. "/" .. name, "w") + if file == nil then return false end + file:write(contents) + file:close() + end + + return true +end + -- merger support -- Fields in the mergers structure: ============================================================ --- tester.cc 155bfd8706809100e1cff699c46c2c2f4d0a7049 +++ tester.cc b628066507ab63cd5de7feb76bd83a10c0d08568 @@ -313,22 +313,6 @@ LUAEXT(copy_recursive, ) } } -LUAEXT(mkdir, ) -{ - try - { - char const * dirname = luaL_checkstring(LS, -1); - do_mkdir(dirname); - lua_pushboolean(LS, true); - return 1; - } - catch(recoverable_failure & e) - { - lua_pushnil(LS); - return 1; - } -} - LUAEXT(make_temp_dir, ) { try