Skip to content

Commit

Permalink
1. Fix no execute 7z command to decompress xtoolbox#4 xtoolbox#6
Browse files Browse the repository at this point in the history
2. Fix rd: command not found under Linux
  • Loading branch information
iysheng committed Nov 23, 2022
1 parent af10557 commit 9fcd3aa
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions ad_lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -955,8 +955,23 @@ local function adCompToSymbol(comp, libname4symbol)
return r
end

function fileExist(name)
local file,err = io.open(name)
if file then
io.close(file)
return true
end
--logData(err)
return false
end

local function parseComp(compPath, fonts)
local blocks = parseADBlockFile(compPath.."/data")
local blocks
if fileExist(compPath.."/data") then
blocks = parseADBlockFile(compPath.."/data")
else
blocks = parseADBlockFile(compPath.."/Data")
end
local r = {}
r.texts = {}
r.graphs = {}
Expand Down Expand Up @@ -1002,7 +1017,7 @@ end
function convert_schlib(inputName, outputName, fpLibName,logFunc)
logData = logFunc or logData
local oPath = string.gsub(inputName, "(%.[^%.]+)$", "")
exec('7z x "'..inputName ..'" -y -o"'..oPath..'"')
os.execute('7z x "'..inputName ..'" -y -o"'..oPath..'"')
if not outputName or outputName == "" then
outputName = oPath .. ".lib"
end
Expand All @@ -1021,5 +1036,11 @@ EESchema-LIBRARY Version 2.4
else
logData(e)
end
exec('rd "' .. oPath .. '" /Q /S')
if package.config:sub(1,1) == '/' then
logData("Linux")
os.execute('rm ' .. oPath .. ' -fr')
else
logData("Windows")
os.execute('rd "' .. oPath .. '" /Q /S')
end
end

0 comments on commit 9fcd3aa

Please sign in to comment.