
12.10.2022, 21:08
|
|
Постоянный
Регистрация: 14.02.2018
Сообщений: 319
С нами:
4338525
Репутация:
98
|
|
Сообщение от k1zn
Lua:
Код:
--- Check if a file or directory exists in this path
function
exists
(
file
)
local
ok
,
err
,
code
=
os
.
rename
(
file
,
file
)
if
not
ok
then
if
code
==
13
then
-- Permission denied, but it exists
return
true
end
end
return
ok
,
err
end
--- Check if a directory exists in this path
function
isdir
(
path
)
-- "/" works on both Unix and Windows
return
exists
(
path
..
"/"
)
end
-- проверить существует ли директория: if (isdir(путь)) then ... end
проще не получится?
|
|
|