Modules/FileSystem/translator/createDir: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ This function creates a directory inside of a translator directory hierarchy. ==Syntax== <syntaxhighlight lang="lua"> bool translator:createDir ( string dirPath ) </syntaxhighlight> ==Arguments== *'''dirPath:''' a path to a directory that should be created ==Returns== This function returns '''true''' if the given path is a valid directory path relative to the translator, '''false''' otherwise. ==Example== <section name="Client" class="client" show="true"> T...")
 
No edit summary
 
Line 1: Line 1:
<pageclass class="#3c82c8" subcaption="Translator function"></pageclass>
__NOTOC__
__NOTOC__
This function creates a directory inside of a translator directory hierarchy.
This function creates a directory inside of a translator directory hierarchy.

Latest revision as of 03:25, 23 January 2022

This function creates a directory inside of a translator directory hierarchy.

Syntax

bool translator:createDir ( string dirPath )

Arguments

  • dirPath: a path to a directory that should be created

Returns

This function returns true if the given path is a valid directory path relative to the translator, false otherwise.

Example

Click to collapse [-]
Client

This snippet creates a folder hierarchy.

-- Create a generic resource root translator
local resRoot = fileCreateTranslator( "/" );

-- Create some folders.
resRoot:createDir( "theDirectory/" ); -- successfully creates "theDirectory" folder
resRoot:createDir( "secondDirectory" ); -- fails to create "secondDirectory" as intended, because it is not a valid dirPath
resRoot:createDir( "thirdDirectory/fourthDirectory/documents/" ); -- successfully creates three directories at a time
resRoot:createDir( "../hax/" ); -- fails to create "hax" directory, because the path is not relative to the translator anymore

FileSystem Translator Functions