Class MixedRealityToolkitFiles
API for working with MixedRealityToolkit folders contained in the project.
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit.Utilities.Editor
Assembly: cs.temp.dll.dll
Syntax
public static class MixedRealityToolkitFiles
Remarks
This class works by looking for sentinel files (following the pattern MRTK.*.sentinel, for example, MRTK.Core.sentinel) in order to identify where the MRTK is located within the project.
Properties
AreFoldersAvailable
Are any of the MRTK directories available?
Declaration
public static bool AreFoldersAvailable { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
If a search is currently in progress, then property will wait synchronously for the task to finish with timeout of 1 second
GetGeneratedFolder
Creates the MixedRealityToolkit.Generated folder if it does not exist and returns the path to the generated folder.
Declaration
public static string GetGeneratedFolder { get; }
Property Value
Type | Description |
---|---|
String |
MRTKDirectories
Returns a collection of MRTK Core directories found in the project.
Declaration
public static IEnumerable<string> MRTKDirectories { get; }
Property Value
Type | Description |
---|---|
IEnumerable<String> |
Remarks
File/Folder paths returned are absolute, not relative
Methods
GetAssetDatabasePath(String)
Maps an absolute path to be relative to the Project Root path (the Unity folder that contains Assets)
Declaration
public static string GetAssetDatabasePath(string absolutePath)
Parameters
Type | Name | Description |
---|---|---|
String | absolutePath | The absolute path to the project. |
Returns
Type | Description |
---|---|
String | The project relative path. |
Remarks
This doesn't produce paths that contain step out '..' relative paths.
GetDirectories(MixedRealityToolkitModuleType)
Get list of discovered directories for provided module type
Declaration
public static IEnumerable<string> GetDirectories(MixedRealityToolkitModuleType module)
Parameters
Type | Name | Description |
---|---|---|
MixedRealityToolkitModuleType | module | Module type to filter against |
Returns
Type | Description |
---|---|
IEnumerable<String> | string list of discovered directory paths |
Remarks
File/Folder paths returned are absolute, not relative
GetFiles(MixedRealityToolkitModuleType, String)
Returns files from all folder instances of the MRTK folder relative path.
Declaration
public static string[] GetFiles(MixedRealityToolkitModuleType module, string mrtkRelativeFolder)
Parameters
Type | Name | Description |
---|---|---|
MixedRealityToolkitModuleType | module | |
String | mrtkRelativeFolder | The MRTK folder relative path to the target folder. |
Returns
Type | Description |
---|---|
String[] | The array of files. |
GetFiles(String)
Returns files from all folder instances of the core MRTK folder relative path.
Declaration
public static string[] GetFiles(string mrtkRelativeFolder)
Parameters
Type | Name | Description |
---|---|---|
String | mrtkRelativeFolder | The core MRTK folder relative path to the target folder. |
Returns
Type | Description |
---|---|
String[] | The array of files. |
GetModuleFromPackageFolder(String)
Finds the module type, if found, from the specified package folder name.
Declaration
public static MixedRealityToolkitModuleType GetModuleFromPackageFolder(string packageFolder)
Parameters
Type | Name | Description |
---|---|---|
String | packageFolder | The asset folder name (ex: MixedRealityToolkit.Providers) |
Returns
Type | Description |
---|---|
MixedRealityToolkitModuleType | MixedRealityToolkitModuleType associated with the package folder name. Returns MixedRealityToolkitModuleType.None if an appropriate module type could not be found. |
MapModulePath(MixedRealityToolkitModuleType)
Get the relative asset folder path to the provided Module type
Declaration
public static string MapModulePath(MixedRealityToolkitModuleType module)
Parameters
Type | Name | Description |
---|---|---|
MixedRealityToolkitModuleType | module | Module type to search for |
Returns
Type | Description |
---|---|
String |
Remarks
Returns first valid module folder path (relative) found. Returns null otherwise.
MapRelativeFilePath(MixedRealityToolkitModuleType, String)
Maps a single relative path file to a concrete path from one of the MRTK folders, if found. Otherwise returns null.
Declaration
public static string MapRelativeFilePath(MixedRealityToolkitModuleType module, string mrtkPathToFile)
Parameters
Type | Name | Description |
---|---|---|
MixedRealityToolkitModuleType | module | |
String | mrtkPathToFile | The MRTK folder relative path to the file. |
Returns
Type | Description |
---|---|
String | The project relative path to the file. |
MapRelativeFilePath(String)
Maps a single relative path file to a concrete path from one of the core MRTK folders, if found. Otherwise returns null.
Declaration
public static string MapRelativeFilePath(string mrtkPathToFile)
Parameters
Type | Name | Description |
---|---|---|
String | mrtkPathToFile | The core MRTK folder relative path to the file. |
Returns
Type | Description |
---|---|
String | The project relative path to the file. |
MapRelativeFilePathToAbsolutePath(MixedRealityToolkitModuleType, String)
Overload of MapRelativeFilePathToAbsolutePath which provides the ability to specify the module that the file belongs to.
Declaration
public static string MapRelativeFilePathToAbsolutePath(MixedRealityToolkitModuleType module, string mrtkPathToFile)
Parameters
Type | Name | Description |
---|---|---|
MixedRealityToolkitModuleType | module | |
String | mrtkPathToFile |
Returns
Type | Description |
---|---|
String |
Remarks
When searching for a resource that lives in the MixedRealityToolkit.SDK folder, this could be invoked in this way: MapRelativeFilePathToAbsolutePath(MixedRealityToolkitModuleType.SDK, mrtkPathToFile)
MapRelativeFilePathToAbsolutePath(String)
Maps a single relative path file to MRTK folders to its absolute path, if found. Otherwise returns null.
Declaration
public static string MapRelativeFilePathToAbsolutePath(string mrtkPathToFile)
Parameters
Type | Name | Description |
---|---|---|
String | mrtkPathToFile |
Returns
Type | Description |
---|---|
String |
Remarks
For example, this will map "Inspectors\Data\EditorWindowOptions.json" to its full path like "c:\project\Assets\Libs\MRTK\MixedRealityToolkit\Inspectors\Data\EditorWindowOptions.json". This assumes that the passed in mrtkPathToFile is found under the "MixedRealityToolkit" folder (instead of the MixedRealityToolkit.SDK, or any of the other folders).
MapRelativeFolderPathToAbsolutePath(MixedRealityToolkitModuleType, String)
Similar to MapRelativeFilePathToAbsolutePath, except this checks for the existence of a folder instead of file.
Declaration
public static string MapRelativeFolderPathToAbsolutePath(MixedRealityToolkitModuleType module, string mrtkPathToFolder)
Parameters
Type | Name | Description |
---|---|---|
MixedRealityToolkitModuleType | module | |
String | mrtkPathToFolder |
Returns
Type | Description |
---|---|
String |
Remarks
Returns first valid path found
RefreshFolders()
Force refresh of MRTK tracked folders. Fires and forgets async call. Returns immediately
Declaration
public static void RefreshFolders()
Remarks
Kicks off async refresh of the MRTK folder database.
WaitForFolderRefresh()
Get task tracking folder refresh if component wants to wait for files to be ready
Declaration
public static Task WaitForFolderRefresh()
Returns
Type | Description |
---|---|
Task |