FileUtil.PathToAbsolutePath
Suggest a change
Success!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Close
Submission failed
For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Close
Declaration
public static String PathToAbsolutePath(String path);
Parameters
| Parameter |
Description |
| path |
Relative path. |
Returns
String
Absolute devirtualized path with unified separators.
Description
Resolves a virtual path to a real absolute path and fixes separators if necessary.
Additional resources: VersionControl.FileMode
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
}
}
}