- Home /
System.IO.IOException: Win32 IO returned 25?anyone
ok, i really have no idea on how to save myself now, plz help! i got my save/load feature which use filestream to write/read file to/from drive. everything working as expected both on my PC and device, then i move onto add in all the ad networks and google play into my game. and after that, i realize my save feature has broken now on my device, but still ok on my PC i check in adb, and when the save happen, "System.IO.IOException: Win32 IO returned 25" was printed.
my save was fine before i added in those ads plugs, where there was no android manifest file in my Unity project. but even when i have the manifest file in my project now, i sure have added in all the read write permission explictly in it
has this got anything to do with my android manifest and/or the jar file that is got imported in/created when adding in the ads plugs?
please help me out on this
why on earth the two file path output string are different? even when they are pointing to the same location on device
Answer by CyberTurboPlays · Nov 10, 2014 at 03:18 PM
just for the sake of record, i will update this post 1 last time, and it will be an answer to my own.
i hav completely over come this issue by simply change from this:
Directory.CreateDirectory(Application.dataPath + "\\DotData")
to this:
Directory.CreateDirectory(Application.dataPath + "/DotData")
when with Directory.CreateDirectory(Application.dataPath + "\\DotData")
, PC and Device can create dir no problem, as long as android.permission.WRITE_EXTERNAL_STORAGE is not asked.
and now with Directory.CreateDirectory(Application.dataPath + "/DotData")
, both PC and device will create the same dir like before, but this one works OK, even when android.permission.WRITE_EXTERNAL_STORAGE is asked on device.
another little question comes to mind rightaway, why would anyone wanted to use "\\"
rather than "/"
? the reason why i used was i saw most of the example code when creating dir and/or file would use "\\"
. what do you say? when do you use "\\"
and when for "/"
anyway, thx Unity, for giving me a place to finally answer to myself, great kudo to you
You should use:
Application.persistentDataPath + Path.DirectorySeparatorChar + "DotData"
Answer by Bunny83 · Nov 06, 2014 at 04:23 PM
IO Error 25 probably means that you're reached the end of the file. So you either try to read more data than there is, or for some reason you can't write the file (maybe out of space?).
I guess it's the reading case and it's either because you didn't serialize the data in a way it can be resored reliably or the data you want to read is in an outdated format. Since you said you changed / added stuff it's most likely a version conflict between your save data and your current implementation.
i go back to the apk which was built when there is no ad not even android manifest in my Unity proj (the pure game built) and test. adb return : I/Unity ( 2000): /data/data/com.CyberTurboPlays.DragFaster/files/DotData/CTPDotData.Tgd Saved
the problem one is like: I/Unity (31976): IOException: Win32 IO returned 25. Path: /storage/sdcard0/Android/data/com.CyberTurboPlays.DragFaster/files/DotData I/Unity (31976): at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in :0 I/Unity (31976): at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in :0 I/Unity (31976): at TBF_SaveLoad.TB_Save () [0x00000] in : 0
any thought ?
Um, so the two file paths are different. One is pointing to the internal storage, the other to the storage card. $$anonymous$$aybe one of the plugins you are using is telling Android that the app uses the storage card. $$anonymous$$aybe you've written to the internal storage, but are trying to read from the storage card? What is baffling is why the Android device is issuing Win32 IO errors. $$anonymous$$akes no sense to me. Strange that the error comes from directory creation code. Are you expecting to create directories?
public void TB_Save()
{
if (!Directory.Exists(Application.dataPath + "\\DotData"))
{
Directory.CreateDirectory(Application.dataPath + "\\DotData");
}
string filePath = Application.dataPath + "\\DotData\\" + "CTPDotData.Tgd";
FileStream FS = new FileStream(filePath, File$$anonymous$$ode.Create);
XmlSerializer XS = new XmlSerializer(typeof(TBF_SaveLoad));
XS.Serialize(FS, this);
FS.Close();
Debug.Log(filePath + " Saved");
}
yeah, i m creating a directory with the save. but everything is ok when there is no "android.permission.WRITE_EXTERNAL_STORAGE".
i m not absolutely sure tho, but i think android internal storage means sdcard0, where as sdcard1 is the external card
Your answer
![](https://koobas.hobune.stream/wayback/20220613170856im_/https://answers.unity.com/themes/thub/images/avi.jpg)