How to deal with the file path?

I don’t know the file path at windows x86,arm and windows phone?
this is my codes

if (Application.platform == RuntimePlatform.Android)
        path = Application.persistentDataPath;        
    else if (Application.platform == RuntimePlatform.WindowsPlayer)
        path = Application.persistentDataPath;
    else if (Application.platform == RuntimePlatform.WP8Player)
        path = Application.persistentDataPath;
    else if (Application.platform == RuntimePlatform.MetroPlayerARM)
        path = Application.persistentDataPath;
    else if (Application.platform == RuntimePlatform.MetroPlayerX86)
        path = Application.persistentDataPath;      
    else if (Application.platform == RuntimePlatform.WindowsEditor)
        path = Application.dataPath;

it’s doesn’t work on windows platform, Android is well done.Who can tell me the path?
and when I ready to punblish it, The “appxmanifeast” need to do something? About permission?

What exactly doesn’t work?

At the Android platform, it can save my create files, but at these Windows platform (eg. windows 8, windows phone), the file can not to be saved.
I think the problem is file path or some software permission.

Saving to Application.persistentDataPath should definitely work and not need any extra permissions. What happens when you try to save files?

This is my codes

function WriteFileGuanQia(fileName : String, modeType : int)
{
var filePath : String = path + “//” + fileName;

var sw : StreamWriter;
var fi = new FileInfo(filePath);
if (!fi.Exists)
sw = fi.CreateText();
else
{
fi.Delete();
sw = fi.CreateText();
}

var dic : Dictionary.<int, int> = new Dictionary.<int, int>();
if (modeType == 1)
dic = mode1Dic;
else if (modeType == 2)
dic = mode2Dic;
else if (modeType == 3)
dic = mode3Dic;

for (var item in dic)
{
var sb = item.Key+" "+item.Value;
sw.WriteLine(sb);
}

sw.Close();
sw.Dispose();
Debug.Log(“write success”);
}

Do you know why the “PlayPrefs” can not save data at Windows 8 platform? It doesn’t work, so I try to use writer files to instead, but it also have problems, Can you tell me the reason? Thanks a lot.

You have to call PlayerPrefs.Save()

Thanks, I will try it.:wink:

How about Json ? We can use what to deserialization ? I try to the LitJson or Newtonsoft.Json, at Windows 8 platform is also have some problems, Can you tell how to solve it ?

I’m a student, I am very glad that you can help me.