From 70ae5b15fb66ae8df462f498941bb28f24dd658c Mon Sep 17 00:00:00 2001 From: starkos Date: Thu, 7 Jan 2010 16:24:17 +0000 Subject: Adjusted string length limits to build on VS2003 --- scripts/embed.lua | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/embed.lua b/scripts/embed.lua index ddb5ba4..31edad7 100644 --- a/scripts/embed.lua +++ b/scripts/embed.lua @@ -47,17 +47,23 @@ local function writefile(out, fname, contents) -- cut smaller than max, so I don't wind up with tiny strings at end of files - local cut = 8192 - local max = 9216 + local max = 2048 -- break up large strings to fit in Visual Studio's string length limit local start = 1 local len = contents:len() while start <= len do local n = len - start - if n > max then n = cut end - writeline(out, contents:sub(start, start + n)) - start = start + n + 1 + if n > max then n = max end + local finish = start + n + + -- make sure I don't cut an escape sequence + while contents:sub(finish, finish) == "\\" do + finish = finish - 1 + end + + writeline(out, contents:sub(start, finish)) + start = finish + 1 end writeline(out, "EOF:" .. fname) -- cgit v1.2.3