Fixed bugs in new C functions

This commit is contained in:
starkos 2009-04-28 14:17:20 +00:00
parent e10aa03cdc
commit 8b52a6e285
6 changed files with 19 additions and 15 deletions

View File

@ -242,6 +242,13 @@
-- set the project location, if not already set
cfg.location = cfg.location or cfg.basedir
-- deduce and store the applicable tool for this configuration
if cfg.language == "C" or cfg.language == "C++" then
if _OPTIONS.cc then cfg.tool = premake[_OPTIONS.cc] end
elseif cfg.language == "C#" then
if _OPTIONS.dotnet then cfg.tool = premake[_OPTIONS.dotnet] end
end
-- remove excluded files from the file list
local files = { }
@ -302,13 +309,6 @@
--
local function buildtargets(cfg)
-- deduce and store the applicable tool for this configuration
if cfg.language == "C" or cfg.language == "C++" then
if _OPTIONS.cc then cfg.tool = premake[_OPTIONS.cc] end
elseif cfg.language == "C#" then
if _OPTIONS.dotnet then cfg.tool = premake[_OPTIONS.dotnet] end
end
-- deduce the target and path style from the current action/tool pairing
local action = premake.actions[_ACTION]
@ -409,6 +409,6 @@
if profiler then
profiler:stop()
dumpresults()
dumpresults(true)
end
end

View File

@ -17,7 +17,7 @@
-- if the directory is already absolute I don't need to do anything
local result = iif (path.isabsolute(p), nil, os.getcwd())
-- split up the supplied relative path and tackle it bit by bit
for _,part in ipairs(p:explode("/", true)) do
if (part == "") then

View File

@ -10,7 +10,7 @@
int path_isabsolute(lua_State* L)
{
const char* path = luaL_checkstring(L, 1);
if (path[0] == '/' || path[0] == '\\' || (path[0] != '\0' && path[2] == ':'))
if (path[0] == '/' || path[0] == '\\' || (path[0] != '\0' && path[1] == ':'))
{
lua_pushboolean(L, 1);
return 1;

View File

@ -9,14 +9,14 @@
int string_endswith(lua_State* L)
{
const char* haystack = luaL_checkstring(L, 1);
const char* needle = luaL_checkstring(L, 2);
const char* haystack = luaL_optstring(L, 1, NULL);
const char* needle = luaL_optstring(L, 2, NULL);
if (haystack && needle)
{
int hlen = strlen(haystack);
int nlen = strlen(needle);
if (hlen > nlen)
if (hlen >= nlen)
{
lua_pushboolean(L, strcmp(haystack + hlen - nlen, needle) == 0);
return 1;

View File

@ -4,7 +4,7 @@
-- Copyright (c) 2009 Jason Perkins and the Premake project
--
local numprojects = 50
local numprojects = 20
local numfiles = 100
dofile("pepperfish_profiler.lua")
@ -18,7 +18,7 @@ end
solution "MySolution"
configurations { "Debug", "Release", "DebugDLL", "ReleaseDLL" }
-- platforms { "Native", "x32", "x64" }
platforms { "Native", "x32", "x64" }
location "build"
configuration "Debug"

View File

@ -31,6 +31,10 @@
function T.string.endswith_ReturnsFalse_OnNilNeedle()
test.isfalse(string.endswith("Abc", nil))
end
function T.string.endswith_ReturnsTrue_OnExactMatch()
test.istrue(string.endswith("/", "/"))
end