RaptorPaths
Resolves RAPTOR's install and data folders.
| Namespace | Assembly | Kind | Stability |
|---|---|---|---|
Raptor.EditorTools | Raptor.Editor | class | preview, since 0.1.0 |
Use Install for read-only content RAPTOR ships and Data for files the tools write. Paths are resolved on first use and cached until the project changes.
Root comes from the core editor assembly's asmdef. It is Assets/RAPTOR in an Assets install, Packages/com.littlewood.raptor in a UPM install, or the folder an Assets install was moved to.
Core data stays in Assets/RAPTOR/... while legacy data (Models, Baked or Exported) exists there. Otherwise it goes to DataFolder or the project's data root setting. Data is never written under Packages/ or inside RAPTOR's folder.
Modules register their root with RegisterModuleRoot. Module data goes to Assets/RAPTOR Data/<module>/... unless the module names a legacy data folder that exists.
public static class RaptorPathsFields
Core
public const string Core;The core module id. Data(Core, rel) is the same as Data(rel).
DataFolder
public const string DataFolder;The data folder used when there is no legacy data and no data root setting.
LegacyRoot
public const string LegacyRoot;RAPTOR's original install folder. Used as the root when no asmdef is found.
Properties
IsPackageInstall
public static bool IsPackageInstall { get; }Whether RAPTOR is installed as a package (its root is under Packages/).
LegacyDataPresent
public static bool LegacyDataPresent { get; }Whether legacy RAPTOR data (Models, Baked or Exported under LegacyRoot) exists. While it does, core data stays in LegacyRoot and the data root setting is ignored.
Root
public static string Root { get; }Gets RAPTOR's root folder (project-relative, forward slashes, no trailing slash).
Methods
Data
public static string Data(string module, string rel)Returns a module's data path. This is the module's legacy data folder while it exists, otherwise <data root>/<module>/rel. It is never under Packages/.
| Parameter | Type | Description |
|---|---|---|
module | string | The module's id. |
rel | string | The path under the root. |
Returns: The path.
Data
public static string Data(string rel)Returns a core data path. See the class remarks for how it is resolved.
| Parameter | Type | Description |
|---|---|---|
rel | string | The path under the root. |
Returns: The path.
EnsureDataFolder
public static string EnsureDataFolder(string module, string rel)Same as Data, but creates the folder and its parents when missing.
| Parameter | Type | Description |
|---|---|---|
module | string | The module's id. |
rel | string | The path under the root. |
Returns: The path.
EnsureDataFolder
public static string EnsureDataFolder(string rel)Same as Data, but creates the folder and its parents when missing.
| Parameter | Type | Description |
|---|---|---|
rel | string | The path under the root. |
Returns: The path.
Install
public static string Install(string module, string rel)Returns the path of shipped, read-only module content (ModuleRoot/rel), or null when the module is not present.
| Parameter | Type | Description |
|---|---|---|
module | string | The module's id. |
rel | string | The path under the root. |
Returns: The path, or null when the module is not present.
Install
public static string Install(string rel)Returns the path of shipped, read-only core content (Root/rel).
| Parameter | Type | Description |
|---|---|---|
rel | string | The path under the root. |
Returns: The path.
ModuleRoot
public static string ModuleRoot(string module)Returns a module's root, or null when the module is not registered.
| Parameter | Type | Description |
|---|---|---|
module | string | The module's id. |
Returns: The folder, or null.
RegisterModuleRoot
public static void RegisterModuleRoot(string module, Func<string> root, string legacyDataRoot = null)Registers or replaces a module's root. root is called on first use after each project change, and typically resolves the folder from a MonoScript in the module. legacyDataRoot is an optional folder under Assets/ where the module's data used to live. While that folder exists, the module's data stays there.
| Parameter | Type | Default | Description |
|---|---|---|---|
module | string | The module's id. | |
root | Func<string> | Returns the module's folder; called lazily. | |
legacyDataRoot | string | null | An older data folder to keep using while it exists, or null. |
Call from an [InitializeOnLoad] static constructor on the main thread. If root throws, the module has no root.