add saveFileJSONrootEx with overwrite function
This commit is contained in:
1 parent
3fe6c417be
commit
c83c62855b
2 files changed
+10
-1
No files matched your search
@@ -667,10 +667,18 @@ out:
|
||||
return retval;
|
||||
}
|
||||
int saveFileJSONroot(const char *preferredName, void *root, size_t flags, bool verbose) {
|
||||
return saveFileJSONrootEx(preferredName, root, flags, verbose, false);
|
||||
}
|
||||
int saveFileJSONrootEx(const char *preferredName, void *root, size_t flags, bool verbose, bool overwrite) {
|
||||
if (root == NULL)
|
||||
return PM3_EINVARG;
|
||||
|
||||
char *filename = newfilenamemcopy(preferredName, ".json");
|
||||
char *filename = NULL;
|
||||
if (overwrite)
|
||||
filename = filenamemcopy(preferredName, ".json");
|
||||
else
|
||||
filename = newfilenamemcopy(preferredName, ".json");
|
||||
|
||||
if (filename == NULL)
|
||||
return PM3_EMALLOC;
|
||||
|
||||
|
||||
Reference in new issue
Block a user