File System
File System Intro
See File System Overview for details.
File System Management
1. Inject file system path mapping rules
Use injectFileSystemRule to inject a file path mapping for a protocol name.
API
func injectFileSystemRule(maskPath: String, realPath: String) throws
Parameters
| Param | Type | Required | Description |
|---|---|---|---|
maskPath | String | Yes | Protocol name |
realPath | String | Yes | File path |
Example
/// Inject a new conversion rule; implementation uses string replacement.
/// Use this to add a mapping between a virtual path and a real path.
/// Built-in rules:
/// 1. tjfile://usr/ -> <host user data path>/fs/usr
/// 2. tjfile://save_ -> <host user data path>/fs/store
/// 3. tjfile://tmp_ -> <host temp file path>/fs
/// Example:
/// maskPath: tjfile://usr/
/// realPath: /.../application support/userid/appid/
/// injectFileSystemRule(maskPath: maskPath, realPath: realPath)
/// Afterward, convertRealPathToMaskPath(realPath: realPath) returns tjfile://usr/
gameHandle.injectFileSystemRule(maskPath: "protocol name", realPath: "path")
gameHandle.convertRealPathToMaskPath(realPath: "path")