Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commits (1)
...@@ -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
......