PathToAbsolutePath(string)
Resolves a virtual path to a real absolute path and fixes separators if necessary.
Read time 1 minuteLast updated 13 days ago
Definition
- Type: Method
- Namespace: UnityEditor
- Assembly: UnityEditor.CoreModule
public static string PathToAbsolutePath(string path)
Parameters
Relative path.
Returns
Type | Description |
|---|---|
| string | Absolute devirtualized path with unified separators. |
Remarks
Additional Resources: FileMode
Examples
using System.IO;using UnityEditor;public class MyFileUtility{ [MenuItem("Test/Open File")] static void OpenFile() { using (var file = File.Open(FileUtil.PathToAbsolutePath("Packages/com.unity.ide.visualstudio/package.json"), FileMode.OpenOrCreate)) { // Some work on the file opened } }}