r433 - trunk

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Jan 17 05:16:17 EST 2008


Author: icculus
Date: 2008-01-17 05:16:06 -0500 (Thu, 17 Jan 2008)
New Revision: 433

Modified:
   trunk/lua_glue.c
Log:
Generalized MojoSetup.download(), too.


Modified: trunk/lua_glue.c
===================================================================
--- trunk/lua_glue.c	2008-01-17 10:13:06 UTC (rev 432)
+++ trunk/lua_glue.c	2008-01-17 10:16:06 UTC (rev 433)
@@ -788,6 +788,14 @@
 } // luahook_writefile
 
 
+static int luahook_download(lua_State *L)
+{
+    const char *src = luaL_checkstring(L, 1);
+    MojoInput *in = MojoInput_fromURL(src);
+    return do_writefile(L, in, MojoPlatform_defaultFilePerms());
+} // luahook_download
+
+
 static int luahook_copyfile(lua_State *L)
 {
     const char *src = luaL_checkstring(L, 1);
@@ -819,27 +827,6 @@
 } // luahook_isvalidperms
 
 
-static int luahook_download(lua_State *L)
-{
-    const char *url = luaL_checkstring(L, 1);
-    const char *dst = luaL_checkstring(L, 2);
-    int retval = 0;
-    boolean rc = false;
-    MojoChecksums sums;
-    MojoInput *in = MojoInput_fromURL(url);
-    if (in != NULL)
-    {
-        rc = MojoInput_toPhysicalFile(in, dst, MojoPlatform_defaultFilePerms(),
-                                      &sums, -1, writeCallback, L);
-    } // if
-
-    retval += retvalBoolean(L, rc);
-    if (rc)
-        retval += retvalChecksums(L, &sums);
-    return retval;
-} // luahook_download
-
-
 static int luahook_archive_fromdir(lua_State *L)
 {
     const char *path = luaL_checkstring(L, 1);




More information about the mojosetup-commits mailing list