Welcome to mirror list, hosted at ThFree Co, Russian Federation.

fn_include.c « script « src - github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f2abc1e2d7f0c621964f75ef410ae6b16fc1f4e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
 * \file   fn_include.c
 * \brief  Include an directory in the script, running the contained "premake4.lua".
 * \author Copyright (c) 2008 Jason Perkins and the Premake project
 */

#include "premake.h"
#include "script_internal.h"
#include "base/path.h"


/**
 * Include a directory into the current script, calling the enclosed "premake4.lua".
 * This is a shortcut for `dofile("some_directory/premake4.lua")`.
 */
int fn_include(lua_State* L)
{
	/* append default file name to the passed in path */
	const char* directory = luaL_checkstring(L, 1);
	const char* path = path_join(directory, DEFAULT_SCRIPT_NAME);

	/* then pass it to dofile() */
	lua_pop(L, 1);
	lua_pushstring(L, path);
	return fn_dofile(L);
}