Arma Reforger Script API
Loading...
Searching...
No Matches
Static Public Member Functions | Static Protected Member Functions | Static Protected Attributes | List of all members
SCR_FileIOHelper Interface Reference

Static Public Member Functions

static bool CreateDirectory (string absoluteDirectory)
 OBSOLETE - use FileIO.MakeDirectory instead
Create sub-directories in the proper order, circumventing a FileIO.MakeDirectory limitation.
 
static bool Copy (string source, string destination, bool overwrite=true)
 Copy source file to destination.
 
static array< string > ReadFileContent (string filePath, bool printWarning=true)
 Get file content as array of lines.
 
static bool WriteFileContent (string filePath, notnull array< string > lines)
 Write all lines in the file, replacing all its content Overwrites the file if it exists.
 
static bool IsValidFileName (string fileName)
 Get whether or not a file name is valid for the filesystem.
 
static string SanitiseFileName (string fileName)
 Sanitise the provided file name (removes invalid characters depending on the current OS, directory information, etc)
 

Static Protected Member Functions

static bool IsWindowsBased ()
 

Static Protected Attributes

static const string PATH_DELIMITER = "/"
 
static const string FORBIDDEN_FILENAME_CHARS_WINDOWS = "*/\<>:|?\t\r\n\""
 
static const string FORBIDDEN_FILENAME_CHARS_LINUX = "/"
 

Member Function Documentation

◆ Copy()

static bool SCR_FileIOHelper.Copy ( string  source,
string  destination,
bool  overwrite = true 
)
static

Copy source file to destination.

Parameters
[in]sourcefile to copy
[in]destinationcopy destination
[in]overwriteset to false to prevent an accidental overwrite
Returns

◆ CreateDirectory()

static bool SCR_FileIOHelper.CreateDirectory ( string  absoluteDirectory)
static

OBSOLETE - use FileIO.MakeDirectory instead
Create sub-directories in the proper order, circumventing a FileIO.MakeDirectory limitation.

Parameters
[in]absoluteDirectorye.g C:/Arma4/Data/scripts/My/Sub/Directory
Returns
true if the whole directory structure was created or already exists, false otherwise

◆ IsValidFileName()

static bool SCR_FileIOHelper.IsValidFileName ( string  fileName)
static

Get whether or not a file name is valid for the filesystem.

Parameters
[in]fileNamethe file name to be sanitised - no file path accepted
Returns
true if the provided file name is valid under the current OS, false otherwise

◆ IsWindowsBased()

static bool SCR_FileIOHelper.IsWindowsBased ( )
staticprotected

◆ ReadFileContent()

static array< string > SCR_FileIOHelper.ReadFileContent ( string  filePath,
bool  printWarning = true 
)
static

Get file content as array of lines.

Parameters
[in]filePathrelative or absolute
[in]printWarningtrue to print warning on issue, false otherwise
Returns
array of lines or null if file does not exist or cannot be opened

◆ SanitiseFileName()

static string SCR_FileIOHelper.SanitiseFileName ( string  fileName)
static

Sanitise the provided file name (removes invalid characters depending on the current OS, directory information, etc)

Parameters
[in]fileNamethe file name to be sanitised - can take a file path that will be stripped
Returns
the sanitised, trimmed file name or empty string if no characters are viable

◆ WriteFileContent()

static bool SCR_FileIOHelper.WriteFileContent ( string  filePath,
notnull array< string >  lines 
)
static

Write all lines in the file, replacing all its content Overwrites the file if it exists.

Parameters
[in]filePathrelative or absolute
[in]lines
Returns
true on success, false otherwise

Member Data Documentation

◆ FORBIDDEN_FILENAME_CHARS_LINUX

const string SCR_FileIOHelper.FORBIDDEN_FILENAME_CHARS_LINUX = "/"
staticprotected

◆ FORBIDDEN_FILENAME_CHARS_WINDOWS

const string SCR_FileIOHelper.FORBIDDEN_FILENAME_CHARS_WINDOWS = "*/\<>:|?\t\r\n\""
staticprotected

◆ PATH_DELIMITER

const string SCR_FileIOHelper.PATH_DELIMITER = "/"
staticprotected

The documentation for this interface was generated from the following file: