Skip to content
Snippets Groups Projects
Commit 24bf49ea authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Add a 'readd_always' option to the update() method

This will cause archive file contents to be re-captured/added
parent 63a2631f
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #2094 passed
...@@ -1258,6 +1258,7 @@ js_update_file(JSContext *cx, uintN argc, jsval *arglist) ...@@ -1258,6 +1258,7 @@ js_update_file(JSContext *cx, uintN argc, jsval *arglist)
char* filename = NULL; char* filename = NULL;
JSObject* fileobj = NULL; JSObject* fileobj = NULL;
bool use_diz_always = false; bool use_diz_always = false;
bool readd_always = false;
jsrefcount rc; jsrefcount rc;
ZERO_VAR(file); ZERO_VAR(file);
...@@ -1291,6 +1292,10 @@ js_update_file(JSContext *cx, uintN argc, jsval *arglist) ...@@ -1291,6 +1292,10 @@ js_update_file(JSContext *cx, uintN argc, jsval *arglist)
use_diz_always = JSVAL_TO_BOOLEAN(argv[argn]); use_diz_always = JSVAL_TO_BOOLEAN(argv[argn]);
argn++; argn++;
} }
if(argn < argc && JSVAL_IS_BOOLEAN(argv[argn])) {
readd_always = JSVAL_TO_BOOLEAN(argv[argn]);
argn++;
}
JSBool result = JS_TRUE; JSBool result = JS_TRUE;
char* extdesc = NULL; char* extdesc = NULL;
...@@ -1317,7 +1322,7 @@ js_update_file(JSContext *cx, uintN argc, jsval *arglist) ...@@ -1317,7 +1322,7 @@ js_update_file(JSContext *cx, uintN argc, jsval *arglist)
} else { } else {
if(file.extdesc != NULL) if(file.extdesc != NULL)
truncsp(file.extdesc); truncsp(file.extdesc);
if(strcmp(extdesc ? extdesc : "", file.extdesc ? file.extdesc : "") == 0) if(!readd_always && strcmp(extdesc ? extdesc : "", file.extdesc ? file.extdesc : "") == 0)
p->smb_result = smb_putfile(&p->smb, &file); p->smb_result = smb_putfile(&p->smb, &file);
else { else {
if((p->smb_result = smb_removefile(&p->smb, &file)) == SMB_SUCCESS) { if((p->smb_result = smb_removefile(&p->smb, &file)) == SMB_SUCCESS) {
...@@ -1721,7 +1726,7 @@ static jsSyncMethodSpec js_filebase_functions[] = { ...@@ -1721,7 +1726,7 @@ static jsSyncMethodSpec js_filebase_functions[] = {
,31900 ,31900
}, },
{"update", js_update_file, 3, JSTYPE_BOOLEAN {"update", js_update_file, 3, JSTYPE_BOOLEAN
,JSDOCSTR("filename, file-meta-object [,use_diz_always=false]") ,JSDOCSTR("filename, file-meta-object [,use_diz_always=false] [,readd_always=false]")
,JSDOCSTR("update an existing file in the file base" ,JSDOCSTR("update an existing file in the file base"
", may throw exception on errors (e.g. file rename failure)") ", may throw exception on errors (e.g. file rename failure)")
,31900 ,31900
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment