Guest User

Untitled

a guest
Dec 18th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. string path = GetiPhoneDocumentsPath();
  2. if (System.IO.File.Exists(path) == false) XmlTextWriter textWriter = new XmlTextWriter(path,null);
  3.  
  4. public static string GetiPhoneDocumentsPath()
  5. {
  6. // Your game has read+write access to /var/mobile/Applications/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/Documents
  7. // Application.dataPath returns
  8. // /var/mobile/Applications/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/myappname.app/Data
  9. // Strip "/Data" from path
  10. string path = Application.dataPath.Substring(0, Application.dataPath.Length - 5);
  11. // Strip application name
  12. path = path.Substring(0, path.LastIndexOf('/'));
  13. return path + "/Documents/myFile.xml";
  14. }
  15.  
  16. FileInfo info = new FileInfo(path);
  17. if (info == null || info.Exists == false) { ... };
Add Comment
Please, Sign In to add comment