squish.lua

changeset 53
bd189ae0de00
parent 46
c09caa0317cc
child 54
90bf9ea1aaf0
--- a/squish.lua	Mon Jul 27 13:21:25 2009 +0100
+++ b/squish.lua	Sat Oct 10 17:37:56 2009 +0100
@@ -239,7 +239,7 @@
 	f:write("do local resources = {};\n");
 	for _, resource in ipairs(resources) do
 		local name, path = resource.name, resource.path;
-		local res_file, err = io.open(base_path..path);
+		local res_file, err = io.open(base_path..path, "rb");
 		if not res_file then
 			print_err("Couldn't load resource: "..tostring(err));
 			os.exit(1);
@@ -248,9 +248,10 @@
 		local maxequals = 0;
 		data:gsub("(=+)", function (equals_string) maxequals = math.max(maxequals, #equals_string); end);
 		
-		f:write(("resources[%q] = ["):format(name), string.rep("=", maxequals+1), "[");
+		f:write(("resources[%q] = %q"):format(name, data));
+--[[		f:write(("resources[%q] = ["):format(name), string.rep("=", maxequals+1), "[");
 		f:write(data);
-		f:write("]", string.rep("=", maxequals+1), "];");
+		f:write("]", string.rep("=", maxequals+1), "];"); ]]
 	end
 	if opts.virtual_io then
 		local vio = require_resource("vio");

mercurial