mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
Detect operating system for logfile handling on Linux environments
This commit is contained in:
parent
9fa173c727
commit
8de424410f
1 changed files with 10 additions and 1 deletions
|
@ -4,7 +4,16 @@ local ac = require('ansicolors')
|
||||||
local os = require('os')
|
local os = require('os')
|
||||||
local dash = string.rep('--', 32)
|
local dash = string.rep('--', 32)
|
||||||
local dir = os.getenv('HOME') .. '/.proxmark3/logs/'
|
local dir = os.getenv('HOME') .. '/.proxmark3/logs/'
|
||||||
local logfile = (io.popen('dir /a-d /o-d /tw /b/s "' .. dir .. '" 2>nul:'):read("*a"):match("%C+"))
|
local logfilecmd
|
||||||
|
|
||||||
|
--Determine platform for logfile handling (Windows vs Unix/Linux)
|
||||||
|
if package.config:sub(1,1) == "\\" then
|
||||||
|
logfilecmd = 'dir /a-d /o-d /tw /b/s "' .. dir .. '" 2>nul:'
|
||||||
|
else
|
||||||
|
logfilecmd = 'find "' .. dir .. '" -type f -printf "%T@ %p\\n" | sort -nr | cut -d" " -f2-'
|
||||||
|
end
|
||||||
|
|
||||||
|
local logfile = (io.popen(logfilecmd):read("*a"):match("%C+"))
|
||||||
local log_file_path = dir .. "Paxton_log.txt"
|
local log_file_path = dir .. "Paxton_log.txt"
|
||||||
local nam = ""
|
local nam = ""
|
||||||
local pm3 = require('pm3')
|
local pm3 = require('pm3')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue