
12.10.2022, 21:06
|
|
Флудер
Регистрация: 23.09.2017
Сообщений: 2,409
С нами:
4546268
Репутация:
183
|
|
Сообщение от Kenshi.
как сделать проверку существует ли папка?
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
|
|
|