类型 库 版本 2024.3703 版 关键词 lfs、LuaFileSystem、文件、文件系统 另请参阅 LuaFileSystem 参考
LuaFileSystem 提供了执行各种
要删除目录或文件,请参阅 os.remove()。
要重命名目录或文件,请参阅 os.rename()。
local lfs = require( "lfs" ) -- Get raw path to the app documents directory local doc_path = system.pathForFile( "", system.DocumentsDirectory ) for file in lfs.dir( doc_path ) do -- "file" is the current file or directory name print( "Found file: " .. file ) end
local lfs = require( "lfs" ) -- Get raw path to the app temporary directory local temp_path = system.pathForFile( "", system.TemporaryDirectory ) -- Change current working directory local success = lfs.chdir( temp_path ) --returns true on success local new_folder_path if ( success ) then lfs.mkdir( "MyNewFolder" ) new_folder_path = lfs.currentdir() .. "/MyNewFolder" end