EDIA Core 0.6.0
A Unity XR toolbox for research
Loading...
Searching...
No Matches
Edia.FileManager Class Reference

Static class to handle file IO. More...

Static Public Member Functions

static string[] GetAllFilenamesWithExtensionFrom (string subFolder, string extension)
 Get all filenames with a certain extension from the applications given subfolder.
static string[] GetAllFilenamesFrom (string subFolder)
 Get all filenames with a certain extension from the applications given subfolder.
static string[] GetAllSubFolders (string subFolder)
 Retrieves all subfolder names from the specified subfolder.
static bool CopyDirectory (string sourceDirectory, string targetDirectory, string exclude)
 Copies the contents of a source directory to a target directory.
static bool CopyDirectory (string sourceDirectory, string targetDirectory, string exclude, bool cleanCopy=false)
 Copies the contents of a source directory to a target directory.
static bool CopyDirectory (string sourceDirectory, string targetDirectory)
 Copies all contents from a source directory to a target directory.
static string ReadStringFromApplicationPathSubfolder (string subfolder, string fileName)
 Reads the content of a file located in a specific subfolder of the application's path.
static string ReadStringFromApplicationPath (string fileName)
 Reads a string from a file located in the application's root path.
static bool FileExists (string fileName)
 Determines if a file exists at the specified application path.
static bool FolderExists (string folderName)
 Determines if a folder exists at the specified application path.
static bool DoesConfigsFolderExist ()
 Determines if the configs folder exists in the application path.
static string ReadString (string fileName)
 Tries to read the given text-based file.
static void CopyFileTo (string sourcePath, string filename, string destinationPath)
 Copies a specified file from a source path to a destination path.
static void WriteString (string fileName, string data, bool overwrite)
 Saves a text file to given filename and containts given data.
static void CreateFolder (string folderName)
 Creates a folder in the application data directory.
static string GetCorrectPath ()
 Determines correct path depending on where the application is running on/in.

Detailed Description

Static class to handle file IO.

Member Function Documentation

◆ CopyDirectory() [1/3]

bool Edia.FileManager.CopyDirectory ( string sourceDirectory,
string targetDirectory )
inlinestatic

Copies all contents from a source directory to a target directory.

Parameters
sourceDirectoryThe path to the source directory.
targetDirectoryThe path to the target directory.
Returns
True if the copy operation completes successfully; otherwise, false.

◆ CopyDirectory() [2/3]

bool Edia.FileManager.CopyDirectory ( string sourceDirectory,
string targetDirectory,
string exclude )
inlinestatic

Copies the contents of a source directory to a target directory.

Parameters
sourceDirectoryThe path of the directory to copy from.
targetDirectoryThe path of the directory to copy to.
excludeSpecifies a file extension or pattern that should be excluded during the copy process.
Returns
Returns true if the directory was successfully copied; otherwise, false.

◆ CopyDirectory() [3/3]

bool Edia.FileManager.CopyDirectory ( string sourceDirectory,
string targetDirectory,
string exclude,
bool cleanCopy = false )
inlinestatic

Copies the contents of a source directory to a target directory.

Parameters
sourceDirectoryThe path of the directory to copy from.
targetDirectoryThe path of the directory to copy to.
excludeSpecifies a file extension or pattern that should be excluded during the copy process.
cleanCopyIndicates whether the target directory should be deleted before copying.
Returns
Returns true if the directory was successfully copied; otherwise, false.

◆ CopyFileTo()

void Edia.FileManager.CopyFileTo ( string sourcePath,
string filename,
string destinationPath )
inlinestatic

Copies a specified file from a source path to a destination path.

Parameters
sourcePathThe directory in the source from which the file will be copied.
filenameThe name of the file to copy.
destinationPathThe directory in the destination where the file will be copied to.

◆ CreateFolder()

void Edia.FileManager.CreateFolder ( string folderName)
inlinestatic

Creates a folder in the application data directory.

Name of the file

◆ DoesConfigsFolderExist()

bool Edia.FileManager.DoesConfigsFolderExist ( )
inlinestatic

Determines if the configs folder exists in the application path.

Returns
True if the configs folder exists, otherwise false.

◆ FileExists()

bool Edia.FileManager.FileExists ( string fileName)
inlinestatic

Determines if a file exists at the specified application path.

Parameters
fileNameThe name of the file to check for existence.
Returns
True if the file exists, otherwise false.

◆ FolderExists()

bool Edia.FileManager.FolderExists ( string folderName)
inlinestatic

Determines if a folder exists at the specified application path.

Parameters
folderNameThe name of the folder to check for existence.
Returns
True if the folder exists, otherwise false.

◆ GetAllFilenamesFrom()

string[] Edia.FileManager.GetAllFilenamesFrom ( string subFolder)
inlinestatic

Get all filenames with a certain extension from the applications given subfolder.

Folder to scan

◆ GetAllFilenamesWithExtensionFrom()

string[] Edia.FileManager.GetAllFilenamesWithExtensionFrom ( string subFolder,
string extension )
inlinestatic

Get all filenames with a certain extension from the applications given subfolder.

Folder to scan

filter on specific file type, use * for all

◆ GetAllSubFolders()

string[] Edia.FileManager.GetAllSubFolders ( string subFolder)
inlinestatic

Retrieves all subfolder names from the specified subfolder.

Parameters
subFolderThe parent folder to scan for subfolders.
Returns
An array of subfolder names within the specified folder, or null if the directory does not exist or contains no subfolders.

◆ GetCorrectPath()

string Edia.FileManager.GetCorrectPath ( )
inlinestatic

Determines correct path depending on where the application is running on/in.

Returns
Path to data on specific platform

◆ ReadString()

string Edia.FileManager.ReadString ( string fileName)
inlinestatic

Tries to read the given text-based file.

Parameters
fileNamePath to the file to read
Returns
Content of the file
Exceptions
ArgumentNullExceptionThrown when fileName is null
IOExceptionThrown when an I/O error occurs

◆ ReadStringFromApplicationPath()

string Edia.FileManager.ReadStringFromApplicationPath ( string fileName)
inlinestatic

Reads a string from a file located in the application's root path.

Parameters
fileNameThe name of the file to read from the application's root path.
Returns
A string containing the contents of the specified file.

◆ ReadStringFromApplicationPathSubfolder()

string Edia.FileManager.ReadStringFromApplicationPathSubfolder ( string subfolder,
string fileName )
inlinestatic

Reads the content of a file located in a specific subfolder of the application's path.

Parameters
subfolderThe subfolder within the application path where the file is located.
fileNameThe name of the file to be read.
Returns
The content of the file as a string.

◆ WriteString()

void Edia.FileManager.WriteString ( string fileName,
string data,
bool overwrite )
inlinestatic

Saves a text file to given filename and containts given data.

Name of the file

The data that needs to be written

Overwrite if filename exists.


The documentation for this class was generated from the following file:
  • D:/Felix/Projects/EDIA/edia_core/Assets/com.edia.core/Runtime/Base/Scripts/Experiment/FileManager.cs