util.datamanager: Replace popen(mkdir) with lfs.mkdir, keeping the just-in-time creation until we have the new datamanager API

Mon, 23 Nov 2009 20:18:04 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 23 Nov 2009 20:18:04 +0000
changeset 2157
2ef4458b23d9
parent 2156
575d5db7f14f
child 2158
0ef04962e112
child 2165
529af807ba1a

util.datamanager: Replace popen(mkdir) with lfs.mkdir, keeping the just-in-time creation until we have the new datamanager API

util/datamanager.lua file | annotate | diff | comparison | revisions
--- a/util/datamanager.lua	Mon Nov 23 19:59:32 2009 +0000
+++ b/util/datamanager.lua	Mon Nov 23 20:18:04 2009 +0000
@@ -15,13 +15,13 @@
 local log = require "util.logger".init("datamanager");
 local io_open = io.open;
 local os_remove = os.remove;
-local io_popen = io.popen;
 local tostring, tonumber = tostring, tonumber;
 local error = error;
 local next = next;
 local t_insert = table.insert;
 local append = require "util.serialization".append;
 local path_separator = "/"; if os.getenv("WINDIR") then path_separator = "\\" end
+local lfs_mkdir = require "lfs".mkdir;
 
 module "datamanager"
 
@@ -43,7 +43,7 @@
 local function mkdir(path)
 	path = path:gsub("/", path_separator); -- TODO as an optimization, do this during path creation rather than here
 	if not _mkdir[path] then
-		local x = io_popen("mkdir \""..path.."\" 2>&1"):read("*a");
+		lfs_mkdir(path);
 		_mkdir[path] = true;
 	end
 	return path;

mercurial