Merge pull request #114 from doegox/master

Look for aidlist.json in the client dir
This commit is contained in:
Iceman 2019-03-05 20:46:55 +01:00 committed by GitHub
commit 7fe5d8cd31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -87,10 +87,9 @@ static int smart_loadjson(const char *preferredName, const char *suffix, json_t
if ( suffix == NULL ) return 1;
int retval = 0;
int size = sizeof(char) * (strlen(preferredName) + strlen(suffix) + 10);
int size = sizeof(char) * (strlen(get_my_executable_directory()) + strlen(preferredName) + strlen(suffix) + 10);
char * fileName = calloc(size, sizeof(char));
sprintf(fileName, "%s.%s", preferredName, suffix);
sprintf(fileName, "%s%s.%s", get_my_executable_directory(), preferredName, suffix);
*root = json_load_file(fileName, 0, &error);
if (!*root) {
PrintAndLogEx(ERR, "json (%s) error on line %d: %s", fileName, error.line, error.text);