Skip to content

Commit

Permalink
tools/mkmap-*.lua: avoid mkdir error
Browse files Browse the repository at this point in the history
  • Loading branch information
h20y6m committed Mar 24, 2024
1 parent 3d2fe6b commit 854c6e6
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 16 deletions.
12 changes: 10 additions & 2 deletions tools/mkmap-ai0-ja.lua
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,15 @@ local function make_one_line(o, fd, s)
end end
end

local function mkdir(dirname)
if os.type == "windows" then
dirname = string.gsub(dirname, '/', '\\')
return os.execute('IF NOT EXIST ' .. dirname .. ' MKDIR ' .. dirname)
else
return os.execute('mkdir -p ' .. dirname)
end
end

for fd, v1 in pairs(foundry) do
-- separate でないときは mln などのデータベースを省略してあるので ml などからコピー
if not foundry[fd].separate then
Expand All @@ -242,8 +251,7 @@ for fd, v1 in pairs(foundry) do
for _,s in pairs(v1[1]) do
local dirname = fd
print('jaEmbed: ' .. dirname)
-- Linux しか想定していない
os.execute('mkdir ' .. dirname .. ' &>/dev/null')
mkdir(dirname)
for mnx, mcont in pairs(maps) do
if not string.match(mnx, '-04') or not foundry[fd].noncid or foundry[fd].separate then
local mapbase = gsub(mnx, '@', dirname)
Expand Down
12 changes: 10 additions & 2 deletions tools/mkmap-ai0-ko.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,20 @@ local function make_one_line(o, fd, s)
end end
end

local function mkdir(dirname)
if os.type == "windows" then
dirname = string.gsub(dirname, '/', '\\')
return os.execute('IF NOT EXIST ' .. dirname .. ' MKDIR ' .. dirname)
else
return os.execute('mkdir -p ' .. dirname)
end
end

for fd, v1 in pairs(foundry) do
for _,s in pairs(v1[1]) do
local dirname = fd
print('koEmbed: ' .. dirname)
-- Linux しか想定していない
os.execute('mkdir ' .. dirname .. ' &>/dev/null')
mkdir(dirname)
for mnx, mcont in pairs(maps) do
if not string.match(mnx, '-04') or not foundry[fd].noncid then
local mapbase = gsub(mnx, '@', dirname)
Expand Down
12 changes: 10 additions & 2 deletions tools/mkmap-ai0-sc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,20 @@ local function make_one_line(o, fd, s)
end end
end

local function mkdir(dirname)
if os.type == "windows" then
dirname = string.gsub(dirname, '/', '\\')
return os.execute('IF NOT EXIST ' .. dirname .. ' MKDIR ' .. dirname)
else
return os.execute('mkdir -p ' .. dirname)
end
end

for fd, v1 in pairs(foundry) do
for _,s in pairs(v1[1]) do
local dirname = fd
print('scEmbed: ' .. dirname)
-- Linux しか想定していない
os.execute('mkdir ' .. dirname .. ' &>/dev/null')
mkdir(dirname)
for mnx, mcont in pairs(maps) do
if not string.match(mnx, '-04') or not foundry[fd].noncid then
local mapbase = gsub(mnx, '@', dirname)
Expand Down
12 changes: 10 additions & 2 deletions tools/mkmap-ai0-tc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,20 @@ local function make_one_line(o, fd, s)
end end
end

local function mkdir(dirname)
if os.type == "windows" then
dirname = string.gsub(dirname, '/', '\\')
return os.execute('IF NOT EXIST ' .. dirname .. ' MKDIR ' .. dirname)
else
return os.execute('mkdir -p ' .. dirname)
end
end

for fd, v1 in pairs(foundry) do
for _,s in pairs(v1[1]) do
local dirname = fd
print('tcEmbed: ' .. dirname)
-- Linux しか想定していない
os.execute('mkdir ' .. dirname .. ' &>/dev/null')
mkdir(dirname)
for mnx, mcont in pairs(maps) do
if not string.match(mnx, '-04') or not foundry[fd].noncid then
local mapbase = gsub(mnx, '@', dirname)
Expand Down
12 changes: 10 additions & 2 deletions tools/mkmap-ja.lua
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,15 @@ local function make_one_line(o, fd, s)
end
end

local function mkdir(dirname)
if os.type == "windows" then
dirname = string.gsub(dirname, '/', '\\')
return os.execute('IF NOT EXIST ' .. dirname .. ' MKDIR ' .. dirname)
else
return os.execute('mkdir -p ' .. dirname)
end
end

for fd, v1 in pairs(foundry) do
-- separate でないときは mln などのデータベースを省略してあるので ml などからコピー
if not foundry[fd].separate then
Expand All @@ -464,8 +473,7 @@ for fd, v1 in pairs(foundry) do
for _,s in pairs(v1[1]) do
local dirname = fd .. suffix[s][2]
print('jaEmbed: ' .. dirname)
-- Linux しか想定していない
os.execute('mkdir ' .. dirname .. ' &>/dev/null')
mkdir(dirname)
for mnx, mcont in pairs(maps) do
--if not string.match(mnx, '-04') or string.match(s, jis2004_flag) then
-- フォントが OpenType (CID) の場合は、すべての map を作る
Expand Down
12 changes: 10 additions & 2 deletions tools/mkmap-ko.lua
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,20 @@ local function make_one_line(o, fd, s)
end
end

local function mkdir(dirname)
if os.type == "windows" then
dirname = string.gsub(dirname, '/', '\\')
return os.execute('IF NOT EXIST ' .. dirname .. ' MKDIR ' .. dirname)
else
return os.execute('mkdir -p ' .. dirname)
end
end

for fd, v1 in pairs(foundry) do
for _,s in pairs(v1[1]) do
local dirname = fd .. suffix[s][2]
print('koEmbed: ' .. dirname)
-- Linux しか想定していない
os.execute('mkdir ' .. dirname .. ' &>/dev/null')
mkdir(dirname)
for mnx, mcont in pairs(maps) do
--if not string.match(mnx, '-04') or string.match(s, jis2004_flag) then
if not string.match(mnx, '-04') or not foundry[fd].noncid then
Expand Down
12 changes: 10 additions & 2 deletions tools/mkmap-sc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,20 @@ local function make_one_line(o, fd, s)
end
end

local function mkdir(dirname)
if os.type == "windows" then
dirname = string.gsub(dirname, '/', '\\')
return os.execute('IF NOT EXIST ' .. dirname .. ' MKDIR ' .. dirname)
else
return os.execute('mkdir -p ' .. dirname)
end
end

for fd, v1 in pairs(foundry) do
for _,s in pairs(v1[1]) do
local dirname = fd .. suffix[s][2]
print('scEmbed: ' .. dirname)
-- Linux しか想定していない
os.execute('mkdir ' .. dirname .. ' &>/dev/null')
mkdir(dirname)
for mnx, mcont in pairs(maps) do
--if not string.match(mnx, '-04') or string.match(s, jis2004_flag) then
if not string.match(mnx, '-04') or not foundry[fd].noncid then
Expand Down
12 changes: 10 additions & 2 deletions tools/mkmap-tc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,20 @@ local function make_one_line(o, fd, s)
end
end

local function mkdir(dirname)
if os.type == "windows" then
dirname = string.gsub(dirname, '/', '\\')
return os.execute('IF NOT EXIST ' .. dirname .. ' MKDIR ' .. dirname)
else
return os.execute('mkdir -p ' .. dirname)
end
end

for fd, v1 in pairs(foundry) do
for _,s in pairs(v1[1]) do
local dirname = fd .. suffix[s][2]
print('tcEmbed: ' .. dirname)
-- Linux しか想定していない
os.execute('mkdir ' .. dirname .. ' &>/dev/null')
mkdir(dirname)
for mnx, mcont in pairs(maps) do
--if not string.match(mnx, '-04') or string.match(s, jis2004_flag) then
if not string.match(mnx, '-04') or not foundry[fd].noncid then
Expand Down

0 comments on commit 854c6e6

Please sign in to comment.