[asterisk-commits] mnicholson: branch mnicholson/asttest r191364 - /team/mnicholson/asttest/astt...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 30 07:49:10 CDT 2009


Author: mnicholson
Date: Thu Apr 30 07:49:03 2009
New Revision: 191364

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=191364
Log:
Store the absolute path of the work area instead of a relative path.

Modified:
    team/mnicholson/asttest/asttest/lua/astlib.c

Modified: team/mnicholson/asttest/asttest/lua/astlib.c
URL: http://svn.digium.com/svn-view/asterisk/team/mnicholson/asttest/asttest/lua/astlib.c?view=diff&rev=191364&r1=191363&r2=191364
==============================================================================
--- team/mnicholson/asttest/asttest/lua/astlib.c (original)
+++ team/mnicholson/asttest/asttest/lua/astlib.c Thu Apr 30 07:49:03 2009
@@ -202,6 +202,7 @@
  */
 static int new_asterisk(lua_State *L) {
 	int asterisk_count;
+	char path[PATH_MAX];
 
 	/* get the index for this instance */
 	lua_getfield(L, LUA_REGISTRYINDEX, "astlib_count");
@@ -215,9 +216,17 @@
 	/* create a new table and set some initial values */
 	lua_newtable(L);
 
-	lua_pushliteral(L, "tmp/ast");
+	if (!getcwd(path, sizeof(path))) {
+		lua_pushliteral(L, "error determining working directory: ");
+		lua_pushstring(L, strerror(errno));
+		lua_concat(L, 2);
+		return lua_error(L);
+	}
+
+	lua_pushstring(L, path);
+	lua_pushliteral(L, "/tmp/ast");
 	lua_pushinteger(L, asterisk_count);
-	lua_concat(L, 2);
+	lua_concat(L, 3);
 	lua_setfield(L, -2, "work_area");
 
 	lua_pushinteger(L, asterisk_count);




More information about the asterisk-commits mailing list