mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
luascript: use fileExists
This commit is contained in:
parent
72392ab305
commit
915c200ebc
1 changed files with 4 additions and 9 deletions
|
@ -26,6 +26,7 @@
|
||||||
#include "lauxlib.h"
|
#include "lauxlib.h"
|
||||||
#include "proxmark3.h"
|
#include "proxmark3.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
|
#include "fileutils.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "scandir.h"
|
#include "scandir.h"
|
||||||
|
@ -153,10 +154,8 @@ static int CmdScriptRun(const char *Cmd) {
|
||||||
strcat(script_path, LUA_SCRIPTS_DIRECTORY);
|
strcat(script_path, LUA_SCRIPTS_DIRECTORY);
|
||||||
strcat(script_path, script_name);
|
strcat(script_path, script_name);
|
||||||
strcat(script_path, suffix);
|
strcat(script_path, suffix);
|
||||||
FILE *file;
|
if (fileExists(script_path))
|
||||||
if ((file = fopen(script_path, "r")))
|
|
||||||
{
|
{
|
||||||
fclose(file);
|
|
||||||
PrintAndLogEx(SUCCESS, "Executing: %s, args '%s'\n", script_path, arguments);
|
PrintAndLogEx(SUCCESS, "Executing: %s, args '%s'\n", script_path, arguments);
|
||||||
found = true;
|
found = true;
|
||||||
error = luaL_loadfile(lua_state, script_path);
|
error = luaL_loadfile(lua_state, script_path);
|
||||||
|
@ -170,10 +169,8 @@ static int CmdScriptRun(const char *Cmd) {
|
||||||
strcat(script_path, LUA_SCRIPTS_DIRECTORY);
|
strcat(script_path, LUA_SCRIPTS_DIRECTORY);
|
||||||
strcat(script_path, script_name);
|
strcat(script_path, script_name);
|
||||||
strcat(script_path, suffix);
|
strcat(script_path, suffix);
|
||||||
FILE *file;
|
if (fileExists(script_path))
|
||||||
if ((file = fopen(script_path, "r")))
|
|
||||||
{
|
{
|
||||||
fclose(file);
|
|
||||||
PrintAndLogEx(SUCCESS, "Executing: %s, args '%s'\n", script_path, arguments);
|
PrintAndLogEx(SUCCESS, "Executing: %s, args '%s'\n", script_path, arguments);
|
||||||
found = true;
|
found = true;
|
||||||
error = luaL_loadfile(lua_state, script_path);
|
error = luaL_loadfile(lua_state, script_path);
|
||||||
|
@ -185,10 +182,8 @@ static int CmdScriptRun(const char *Cmd) {
|
||||||
strcat(script_path, LUA_SCRIPTS_DIRECTORY);
|
strcat(script_path, LUA_SCRIPTS_DIRECTORY);
|
||||||
strcat(script_path, script_name);
|
strcat(script_path, script_name);
|
||||||
strcat(script_path, suffix);
|
strcat(script_path, suffix);
|
||||||
FILE *file;
|
if (fileExists(script_path))
|
||||||
if ((file = fopen(script_path, "r")))
|
|
||||||
{
|
{
|
||||||
fclose(file);
|
|
||||||
PrintAndLogEx(SUCCESS, "Executing: %s, args '%s'\n", script_path, arguments);
|
PrintAndLogEx(SUCCESS, "Executing: %s, args '%s'\n", script_path, arguments);
|
||||||
found = true;
|
found = true;
|
||||||
error = luaL_loadfile(lua_state, script_path);
|
error = luaL_loadfile(lua_state, script_path);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue