|
|
| version 1.2, 2001/03/19 20:46:35 | version 1.4, 2001/03/20 06:45:16 |
|---|---|
| Line 12 | Line 12 |
| // global var | // global var |
| VStateless_class *file_base_class; | VStateless_class *file_class; |
| // methods | // methods |
| static void _save(Request& r, const String& method_name, Array *params) { | static void _save(Request& r, const String& method_name, Array *params) { |
| //\Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| Value *vfile_name=static_cast<Value *>(params->get(0)); | Value *vfile_name=static_cast<Value *>(params->get(0)); |
| // forcing | // forcing |
| // ^save{this body type} | // ^save[this body type] |
| r.fail_if_junction_(false, *vfile_name, method_name, "file name must be junction"); | r.fail_if_junction_(true, *vfile_name, |
| method_name, "file name must not be junction"); | |
| { | |
| Temp_lang temp_lang(r, String::Untaint_lang::FILE); | // forcing untaint language |
| static_cast<VFile *>(r.self)->save( | String lfile_name(pool); |
| r.absolute(r.process(*vfile_name).as_string().cstr())); | lfile_name.append(vfile_name->as_string(), |
| } | String::Untaint_lang::FILE_NAME, true); |
| static_cast<VFile *>(r.self)->save(r.absolute(lfile_name.cstr())); | |
| } | } |
| // initialize | // initialize |
| void initialize_file_base_class(Pool& pool, VStateless_class& vclass) { | void initialize_file_class(Pool& pool, VStateless_class& vclass) { |
| // ^save[file-name] | // ^save[file-name] |
| vclass.add_native_method("save", _save, 1, 1); | vclass.add_native_method("save", _save, 1, 1); |
| } | } |