--- parser3/src/classes/file.C 2001/07/20 09:40:46 1.44 +++ parser3/src/classes/file.C 2001/08/06 12:23:11 1.46 @@ -5,9 +5,9 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: file.C,v 1.44 2001/07/20 09:40:46 parser Exp $ + $Id: file.C,v 1.46 2001/08/06 12:23:11 parser Exp $ */ -static const char *RCSId="$Id: file.C,v 1.44 2001/07/20 09:40:46 parser Exp $"; +static const char *RCSId="$Id: file.C,v 1.46 2001/08/06 12:23:11 parser Exp $"; #include "classes.h" #include "pa_request.h" @@ -59,6 +59,17 @@ static void _delete(Request& r, const St file_delete(pool, r.absolute(vfile_name.as_string())); } +static void _move(Request& r, const String&, MethodParams *params) { + Pool& pool=r.pool(); + Value& vfrom_file_name=params->as_no_junction(0, "from file name must not be code"); + Value& vto_file_name=params->as_no_junction(1, "to file name must not be code"); + + // unlink + file_move(pool, + r.absolute(vfrom_file_name.as_string()), + r.absolute(vto_file_name.as_string())); +} + static void _find(Request& r, const String& method_name, MethodParams *params) { Pool& pool=r.pool(); Value& vfile_name=params->as_no_junction(0, "file name must not be code"); @@ -228,8 +239,10 @@ static void _exec_cgi(Request& r, const delim_size=0; // calm down, compiler PTHROW(0, 0, &method_name, - "output does not contain CGI header; exit code=%d; size=%u; text: \"%s\"", - status, (uint)out.size(), out.cstr()); + "output does not contain CGI header; exit code=%d; outsize=%u; out: \"%s\"; errsize=%u; err: \"%s\"", + status, + (uint)out.size(), out.cstr(), + (uint)err.size(), err.cstr()); } const String& header=out.mid(0, pos); @@ -279,6 +292,9 @@ MFile::MFile(Pool& apool) : Methoded(apo // ^delete[file-name] add_native_method("delete", Method::CT_STATIC, _delete, 1, 1); + // ^move[from-file-name;to-file-name] + add_native_method("move", Method::CT_STATIC, _move, 2, 2); + // ^find[file-name] // ^find[file-name]{when-not-found} add_native_method("find", Method::CT_STATIC, _find, 1, 2);