RSX Code Reference
    Preparing search index...
    • rsx
    • FileSystem

    Class FileSystem

    The FileSystem class provides static methods for the manipulation of files and filepaths.

    Index
    altDirectorySeparatorChar: FilePath

    Provides a platform-specific alternate character used to separate directory levels in a path string that reflects a hierarchical file system organization.

    directorySeparatorChar: FilePath

    Provides a platform-specific character used to separate directory levels in a path string that reflects a hierarchical file system organization.

    packageFileExtension: ".rpak"

    The file extension for the RSX package format. The string includes the dot filename separate.

    posixDirectorySeparatorChar: FilePath

    Provides a character used to separate directory levels in a path string that reflects a hierarchical file system organization on POSIX systems.

    windowsDirectorySeparatorChar: FilePath

    Provides a character used to separate directory levels in a path string that reflects a hierarchical file system organization on Windows systems.

    • Changes the extension of a path string.

      Type Parameters

      Parameters

      • path: T

        The path information to modify. The path cannot contain any of the characters defined in System.IO.Path.GetInvalidPathChars.

      • extension: string

        The new extension (with or without a leading period). Specify null to remove an existing extension from path.

      Returns T

      The modified path information.On Windows-based desktop platforms, if path is null or an empty string (""), the path information is returned unmodified.

    • Recursively copies a directory from one path to another, while creating any parent directories if they don't already exist.

      Parameters

      • source: FilePath

        Path to the directory to copy.

      • destination: FilePath

        Path determining where the directory copy will be placed.

      Returns void

    • Copies an existing file to a new file. Overwriting a file of the same name is not allowed.

      Parameters

      • sourceFileName: FilePath

        The file to copy.

      • destFileName: FilePath

        The name of the destination file. This cannot be a directory or an existing file.

      Returns void

    • Copies a file from one path to another, while creating any parent directories if they don't already exist.

      Parameters

      • source: FilePath

        Path to the file to copy.

      • destination: FilePath

        Path to the copied file.

      Returns void

    • Creates all directories and subdirectories in the specified path unless they already exist.

      Parameters

      • path: FilePath

        The directory to create.

      Returns boolean

      True upon success.

    • Deletes the specified directory and, if indicated, any subdirectories and files in the directory.

      Parameters

      • path: FilePath

        The name of the directory to remove.

      • recursive: boolean

        true to remove directories, subdirectories, and files in path; otherwise, false.

      Returns void

    • Deletes the specified file.

      Parameters

      • path: FilePath

        The name of the file to be deleted. Wildcard characters are not supported.

      Returns void

    • Creates a folder at the specified path if it does not exist yet.

      Parameters

      • fullPath: FilePath

        Full path to a full folder to create.

      Returns boolean

      True if the directory exists or was created, false if the directory couldn't be created

    • Ensures that the given path starts with the given prefix. Same path if already does.

      Type Parameters

      Parameters

      • path: T

        The path to check the suffix for.

      • prefix: string | T

        The prefix to add to the path if not yet present.

      Returns T

      The given path prefixed with the given prefix. The same path if already contains the given suffix.

    • Ensures that the given path ends with the given suffix. Same path if already does.

      Type Parameters

      Parameters

      • path: T

        The path to check the suffix for.

      • suffix: string | T

        The suffix to add to the path if not yet present.

      Returns T

      The given path suffixed with the given suffix. The same path if already contains the given suffix.

    • Gets the current working directory of the application.

      Returns FilePath

      A string that contains the path of the current working directory, and does not end with a backslash ().

    • Returns an array of directory names in a specified path.

      Parameters

      • filePath: FilePath

        The relative or absolute path to the directory to search. This string is not case-sensitive.

      • recursive: boolean

      Returns FilePath[]

      An array of the full names (including paths) for the directories in the directory specified by path.

    • Returns the extension of the specified path string.

      Parameters

      • path: string | FilePath

        The path string from which to obtain the file name and extension.

      Returns string

      The extension of the specified path (including the period "."), or null, or System.String.Empty.

    • Returns the file name of the specified path string without the extension.

      Type Parameters

      Parameters

      • path: T

        The path of the file.

      Returns T

      The string returned by System.IO.Path.GetFileName(System.String), minus the last period (.) and all characters following it.

    • Returns an array of file names in a specified path.

      Parameters

      • filePath: string | FilePath

        The relative or absolute path to the directory to search. This string is not case-sensitive.

      • recursive: boolean

      Returns FilePath[]

      An array of the full names (including paths) for the files in the directory specified by path.

    • Gets the size of the file at the specified filePath.

      Parameters

      • filePath: FilePath

        The file to write to.

      Returns number

      The file size.

    • Returns the date and time the specified file or directory was last written to.

      Parameters

      • filepath: FilePath

        The file or directory for which to obtain write date and time information.

      Returns Date

      A Date object set to the date and time that the specified file or directory was last written to. This value is expressed in local time.

    • Returns the parent of the provided path.

      Type Parameters

      Parameters

      • path: T

        Path to return the parent of.

      Returns T

      Parent of the path. This usually means the folder containing the file or folder in the current path.

    • Similar to getTail, but when the given path is a path to a directory, the returned value also contains a separator char at the end to indicate that.

      Type Parameters

      Parameters

      • path: T

        Path to get the tail of.

      Returns T

      Tail of the path. This might be a directory or a filename.

    • Returns whether or not the given path is pointing to a directory.

      Type Parameters

      Parameters

      • path: T

        The path to check for.

      Returns boolean

      True for directory and false for files/resources.

    • Determines whether the given path refers to an existing directory on disk.

      Parameters

      • path: string | FilePath

        The path to test.

      Returns boolean

      true if path refers to an existing directory; false if the directory does not exist or an error occurs

    • Determines whether the specified file exists.

      Parameters

      • path: string | FilePath

        The file to check.

      Returns boolean

      true if the caller has the required permissions and path contains the name of an existing file; otherwise, false.

    • Returns whether or not the given path represents a file or a Resource.

      Type Parameters

      Parameters

      • path: T

        The path to check for.

      Returns boolean

      True for files and resources. False for a directory.

    • Determines if the file has the read-only flag set.

      Parameters

      Returns boolean

    • Moves a directory from one path to another, while creating any parent directories if they don't already exist.

      Parameters

      • source: FilePath

        Path to the directory to move.

      • destination: FilePath

        New location and/or name of the directory.

      Returns void

    • Moves a file from one path to another, while creating any parent directories if they don't already exist.

      Parameters

      • source: FilePath

        Path to the file to move.

      • destination: FilePath

        New location and/or name of the file.

      Returns void

    • Opens a binary file, reads the contents of the file into a byte array, and then closes the file.

      Parameters

      • path: FilePath

        The file to open for reading.

      Returns number[]

      A byte array containing the contents of the file.

    • Opens a text file, reads all lines of the file, and then closes the file.

      Parameters

      • path: FilePath

        The file to open for reading.

      Returns string

      A string containing all lines of the file.

    • Sets the read-only state of the file.

      Parameters

      • path: FilePath
      • isReadOnly: boolean
      • OptionalisRecursive: boolean

      Returns boolean

    • Creates a new file, writes the specified byte array to the file, and then closes the file. If the target file already exists, it is overwritten.

      Parameters

      • path: FilePath

        The file to write to.

      • bytes: number[]

      Returns void

      The bytes to write to the file.

    • Creates a new file, writes the specified stream to the file, and then closes the file. If the target file already exists, it is overwritten.

      Parameters

      • filePath: FilePath

        The file to write to.

      • stream: DataStream

        The stream to write to the file.

      • OptionalseekToBeginning: boolean

        If true, seeks the stream to be beginning.

      Returns boolean

    • Creates a new file, asynchronously writes the specified stream to the file, and then closes the file. If the target file already exists, it is overwritten.

      Parameters

      • filePath: FilePath

        The file to write to.

      • stream: DataStream

        The stream to write to the file.

      • OptionalseekToBeginning: boolean

        If true, seeks the stream to be beginning.

      Returns UncertainAsyncOp<boolean>

    • Creates a new file, writes the specified string to the file, and then closes the file. If the target file already exists, it is overwritten.

      Parameters

      • filePath: FilePath

        The file to write to.

      • contents: string

        The string to write to the file.

      Returns boolean