Change to behaviour of --debug/-g - at the (temporary) loss of squishing modules -g will now give real tracebacks again with original filenames

Sat, 22 Jan 2011 18:04:56 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 22 Jan 2011 18:04:56 +0000
changeset 83
ff14c066a643
parent 82
4d6a976c3bb7
child 84
14f827efadf2

Change to behaviour of --debug/-g - at the (temporary) loss of squishing modules -g will now give real tracebacks again with original filenames

squish.lua file | annotate | diff | comparison | revisions
--- a/squish.lua	Tue Nov 30 13:22:35 2010 +0000
+++ b/squish.lua	Sat Jan 22 18:04:56 2011 +0000
@@ -167,10 +167,6 @@
 	end
 end
 
-if opts.debug then
-	f:write(require_resource("squish.debug"));
-end
-
 print_verbose("Resolving modules...");
 do
 	local LUA_DIRSEP = package.config:sub(1,1);
@@ -240,12 +236,14 @@
 		end
 	end
 	if data then
-		f:write("package.preload['", modulename, "'] = (function (...)\n");
-		f:write(data);
-		f:write(" end)\n");
-		if opts.debug then
-			f:write(string.format("package.preload[%q] = ___adjust_chunk(package.preload[%q], %q);\n\n", 
-				modulename, modulename, "@"..path));
+		if not opts.debug then
+			f:write("package.preload['", modulename, "'] = (function (...)\n");
+			f:write(data);
+			f:write(" end)\n");
+		else
+			f:write("package.preload['", modulename, "'] = assert(loadstring(\n");
+			f:write(("%q\n"):format(data));
+			f:write(", ", ("%q"):format("@"..path), "))\n");
 		end
 	else
 		print_err("Couldn't pack module '"..modulename.."': "..(err or "unknown error... path to module file correct?"));

mercurial