mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 02:27:26 -07:00
add saveFileJSONrootEx with overwrite function
This commit is contained in:
parent
3fe6c417be
commit
c83c62855b
2 changed files with 10 additions and 1 deletions
|
@ -667,10 +667,18 @@ out:
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
int saveFileJSONroot(const char *preferredName, void *root, size_t flags, bool verbose) {
|
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)
|
if (root == NULL)
|
||||||
return PM3_EINVARG;
|
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)
|
if (filename == NULL)
|
||||||
return PM3_EMALLOC;
|
return PM3_EMALLOC;
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,7 @@ int saveFileEML(const char *preferredName, uint8_t *data, size_t datalen, size_t
|
||||||
int saveFileJSON(const char *preferredName, JSONFileType ftype, uint8_t *data, size_t datalen, void (*callback)(json_t *));
|
int saveFileJSON(const char *preferredName, JSONFileType ftype, uint8_t *data, size_t datalen, void (*callback)(json_t *));
|
||||||
int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data, size_t datalen, bool verbose, void (*callback)(json_t *));
|
int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data, size_t datalen, bool verbose, void (*callback)(json_t *));
|
||||||
int saveFileJSONroot(const char *preferredName, void *root, size_t flags, bool verbose);
|
int saveFileJSONroot(const char *preferredName, void *root, size_t flags, bool verbose);
|
||||||
|
int saveFileJSONrootEx(const char *preferredName, void *root, size_t flags, bool verbose, bool overwrite);
|
||||||
/** STUB
|
/** STUB
|
||||||
* @brief Utility function to save WAVE data to a file. This method takes a preferred name, but if that
|
* @brief Utility function to save WAVE data to a file. This method takes a preferred name, but if that
|
||||||
* file already exists, it tries with another name until it finds something suitable.
|
* file already exists, it tries with another name until it finds something suitable.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue