|
grandMA3 ユーザマニュアル » プラグイン » Lua 関数 - Object-Free API » FileExists(string) |
Version 2.2 |
FileExists 関数は、ファイルが存在するかどうかを確認し、結果を boolean 値で返します。
ショーファイル・フォルダにある最初のファイルのフィードバックを返します。この例では、GetPath() 関数と DirList() 関数を用います。
Lua |
return function () -- Get the path to the show files. local path = GetPath(Enums.PathType.Showfiles) -- Get a table of files at the path. local dirTable = DirList(path) -- Get the file name for the first file. local firstFile = dirTable[1]['name'] -- Create a string with the path and filename. local filepath = string.format("%s%s%s", path, GetPathSeparator(), firstFile) -- Check if the file exist and return useful feedback. if FileExists(filepath) then Printf('The file "' .. firstFile .. '" exist at path "' .. path .. '"') else Printf('The file "' .. firstFile .. '" does not exist') end end |