Diff

util/datamanager.lua @ 2159:2ef4458b23d9

util.datamanager: Replace popen(mkdir) with lfs.mkdir, keeping the just-in-time creation until we have the new datamanager API
author Matthew Wild <mwild1@gmail.com>
date Mon, 23 Nov 2009 20:18:04 +0000
parent 1732:f1282fad2f99
child 2328:2804d81206d8
child 2923:b7049746bd29
line wrap: on
line diff
--- 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;