UnifiedIO is available on the Asset Store!
Keeping it brief: UnifiedIO is a library of methods that handle file and directory reading/writing in Application.persistentDataPath. It is “unified” because it does so consistently for all main platforms, including Windows Store Apps (Windows/Mac/Linux, Android, iOS, Windows Phone, Windows Store Apps, Blackberry).
It was developed coming from this old but updated question/answer about IO on Windows Store Apps. Check that link or the library’s documentation for details on the problem that UnifiedIO tries to solve.
The asset includes:
UnifiedIO.Directory class:
bool Exists(string path)
void Create(string path)
void Rename(string path, string newName)
void Move(string path, string destinationPath)
void Copy(string path, string destinationPath)
void MoveInside(string path, string destinationPath)
void CopyInside(string path, string destinationPath)
void Delete(string path)
void DeleteContents(string path)
string[ ] GetFiles(string path, string searchPattern, SearchOption searchOption)
string[ ] GetDirectories(string path, string searchPattern, SearchOption searchOption)
UnifiedIO.File class:
bool Exists(string path)
void CreateEmpty(string path)
void Rename(string path, string newName)
void Move(string path, string destinationPath)
void Copy(string path, string destinationPath)
void MoveInside(string path, string destinationPath)
void CopyInside(string path, string destinationPath)
void Delete(string path)
Stream GetReadStream(string path)
Stream GetWriteStream(string path)
Stream GetAppendStream(string path)
byte[ ] ReadBytes(string path, int position = 0, int nBytes = 0)
void WriteBytes(string path, byte[ ] content)
void WriteBytes(string path, byte[ ] content**,** int position)
void AppendBytes(string path, byte[ ] content)
string ReadText(string path)
void WriteText(string path, string content)
void AppendText(string path, string content)
IList ReadLines(string path)
void WriteLines(string path, IEnumerable content)
void AppendLines(string path, IEnumerable content)
Most of these methods are similar in signature to what you find in the System.IO namespace, but internally include different code for the various main platforms, so that, no matter which one you’re building for, you can read/write/copy/move/rename/delete/enumerate/etc your app’s files and folders in Application.persistentDataPath.
If you want code that just provides IO in Windows Store Apps, while keeping your existing code for other platforms, you can also use UnifiedIO. Simply use platform dependent compilation and call UnifiedIO methods inside #if NETFX_CORE sections. Both the documentation and the question/answer linked before contain more details on this.
Please check the above list of methods before buying, so you don’t feel cheated in any way. If you require a method that is not currently present, I will consider suggestions!
If you buy, leave a rating or review if you can (good or bad; developers need feedback!).
Finally, all UnifiedIO methods were unit-tested, but bugs can slip in any software, so I also welcome any bug reports.
Thanks for checking it out!
- Daniel