Created
January 18, 2013 21:36
-
-
Save drawcode/4568817 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static string GetActualFilePath( string filename ) { | |
| // Prefer our persistent data path | |
| Debug.Log("Checking for " + Application.persistentDataPath + "/" + filename + ".unity3d"); | |
| if (File.Exists(Application.persistentDataPath + "/" + filename + ".unity3d")) { | |
| Debug.Log("File exists in persistent data path!"); | |
| return "file://" + Application.persistentDataPath + "/" + filename + ".unity3d"; | |
| } | |
| // Check platform-specific data path. | |
| if (Application.platform == RuntimePlatform.IPhonePlayer) { | |
| if (File.Exists(Application.dataPath + "/Raw/" + filename + ".unity3d")) { | |
| return "file://" + Application.dataPath + "/Raw/" + filename + ".unity3d"; | |
| } | |
| } else if (Application.platform == RuntimePlatform.Android) { | |
| if (File.Exists(Application.dataPath + "!/assets/" + filename + ".unity3d")) { | |
| return "jar:file://" + Application.dataPath + "!/assets/" + filename + ".unity3d"; | |
| } | |
| } else if (Application.platform == RuntimePlatform.OSXWebPlayer || Application.platform == RuntimePlatform.WindowsWebPlayer) { | |
| if (File.Exists(Application.dataPath + "/StreamingAssets/" + filename + ".unity3d")) { | |
| return Application.dataPath + "/StreamingAssets/" + filename + ".unity3d"; | |
| } | |
| } else { | |
| if (File.Exists(Application.dataPath + "/StreamingAssets/" + filename + ".unity3d")) { | |
| return "file://" + Application.dataPath + "/StreamingAssets/" + filename + ".unity3d"; | |
| } | |
| } | |
| return ""; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment