mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-23 23:55:15 +08:00
Update Full Path
This commit is contained in:
parent
0b43252a02
commit
5545219f82
2 changed files with 9 additions and 39 deletions
|
@ -41,41 +41,18 @@ static int setCmdHelp(const char *Cmd);
|
|||
#endif
|
||||
|
||||
static char* prefGetFilename (void) {
|
||||
/*
|
||||
static char Buffer[FILENAME_MAX+sizeof(preferencesFilename)+2] = {0};
|
||||
char PATH[FILENAME_MAX] = {0};
|
||||
|
||||
getcwd(PATH, sizeof(PATH));
|
||||
#ifdef _WIN32
|
||||
snprintf (Buffer,sizeof(Buffer)-1,"%s\\%s",PATH,preferencesFilename);
|
||||
#else
|
||||
snprintf (Buffer,sizeof(Buffer)-1,"%s/%s",PATH,preferencesFilename);
|
||||
#endif
|
||||
|
||||
return Buffer;
|
||||
*/
|
||||
static char Buffer [FILENAME_MAX] = {0};
|
||||
char *Path;
|
||||
|
||||
// int searchHomeFilePath(char **foundpath, const char *filename, bool create_home);
|
||||
if (searchHomeFilePath(&Path,preferencesFilename,false) == PM3_SUCCESS) {
|
||||
snprintf(Buffer,sizeof(Buffer)-1,"%s",Path);
|
||||
} else {
|
||||
snprintf(Buffer,sizeof(Buffer)-1,"%s",preferencesFilename);
|
||||
}
|
||||
|
||||
|
||||
//printf ("%s [%s]\n",Buffer,get_my_user_directory() );
|
||||
|
||||
// GetCurrentDir (Buffer,sizeof(Buffer));
|
||||
// printf ("%s\n",Buffer, );
|
||||
|
||||
return Buffer;
|
||||
//return preferencesFilename;
|
||||
|
||||
if (searchHomeFilePath(&Path,preferencesFilename,false) == PM3_SUCCESS)
|
||||
return Path;
|
||||
else
|
||||
return preferencesFilename;
|
||||
}
|
||||
|
||||
int preferences_load (void) {
|
||||
|
||||
PrintAndLogEx(INFO,"Looking for preferences...");
|
||||
|
||||
// Set all defaults
|
||||
session.client_debug_level = OFF;
|
||||
session.window_changed = false;
|
||||
|
@ -580,6 +557,7 @@ static int CmdPrefShow (const char *Cmd) {
|
|||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
PrintAndLogEx(NORMAL," Preference file........ "_GREEN_("%s"),prefGetFilename());
|
||||
showEmojiState (prefShowNone);
|
||||
showColorState (prefShowNone);
|
||||
// showPlotPosState ();
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
#include "flash.h"
|
||||
#include "preferences.h"
|
||||
|
||||
// mwalker33 test code
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#define GetCurrentDir _getcwd
|
||||
|
@ -39,8 +37,6 @@
|
|||
#define GetCurrentDir getcwd
|
||||
#endif
|
||||
|
||||
// end test code
|
||||
|
||||
// Used to enable/disable use of preferences json file
|
||||
#define USE_PREFERENCE_FILE
|
||||
|
||||
|
@ -403,24 +399,20 @@ static void set_my_executable_path(void) {
|
|||
}
|
||||
|
||||
static const char *my_user_directory = NULL;
|
||||
|
||||
// mwalker33 test code
|
||||
static char _cwd_Buffer [FILENAME_MAX] = {0};
|
||||
// end test code
|
||||
|
||||
const char *get_my_user_directory(void) {
|
||||
return my_user_directory;
|
||||
}
|
||||
static void set_my_user_directory(void) {
|
||||
my_user_directory = getenv("HOME");
|
||||
|
||||
// if not found, default to current directory
|
||||
if (my_user_directory == NULL) {
|
||||
// mwalker33 test code
|
||||
my_user_directory = GetCurrentDir ( _cwd_Buffer,sizeof( _cwd_Buffer));
|
||||
// change all slashs to / (windows should not care...
|
||||
for (int i = 0; i < strlen(_cwd_Buffer); i++)
|
||||
if (_cwd_Buffer[i] == '\\') _cwd_Buffer[i] = '/';
|
||||
// end
|
||||
// my_user_directory = ".";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue