MTA:Eir/FileSystem/createFilesystemInterface
Jump to navigation
Jump to search
This function creates a FileSystem access point. An access point is your personal instance of the MTA:Eir FileSystem. The table returned by this function is the module namespace. There are no limits as to how many access points can be live at a time.
Syntax
table createFilesystemInterface ()
Returns
This function returns the table that denotes the FileSystem module namespace.
Example
Click to collapse [-]
ClientThis snippet sets up access to your resource in a simple server-side resource environment when using the FileSystem module.
-- Create the interface. local fsys = createFilesystemInterface(); -- Make sure we have access to the module. -- Access could be blocked by acl.xml priviledges. if not ( fsys ) then outputDebugString( "could not create FileSystem interface" ); return false; end -- Assume the resource is located inside a folder in the deathmatch resources directory. -- Then we create a raw OS filesystem link to it. local resRoot = fsys.createTranslator( "mods/deathmatch/resources/" .. getResourceName(resource) .. "/" ); -- Check that we have access (i.e. passed OS priviledges test) for this folder. -- Will fail is the resource is not inside a folder in the deathmatch resources directory. if not ( resRoot ) then outputDebugString( "cannot link resource instance directory" ); return false; end -- Open the "meta.xml" file. local metaFile = resRoot.open( "meta.xml", "rb" ); -- Success!
FileSystem Library Functions
- createFilesystemInterface (module only)
FileSystem Namespace Functions
- createTranslator
- createRAMDisk
- createMemoryFile
- createFileIterative
- createArchiveTranslator (not module)
- createZIPArchive (not module)
- copyFile
- copyStream
- copyStreamCount
- pathToFilename
- streamCompare
- topointer
- type
- setDoBufferAllRaw
- getDoBufferAllRaw
FileSystem Translator Functions
- open
- exists
- createDir
- chdir
- delete
- copy
- rename
- size
- stat
- relPath
- relPathRoot
- absPath
- absPathRoot
- scanDir
- scanDirEx
- getDirs
- getFiles
- setOutbreakEnabled
- getOutbreakEnabled
- setPathProcessingMode
- getPathProcessingMode
FileSystem Archive Translator Functions
- save (not module)