I am trying to code a simple helper that can open and write a file anywhere in the file system that permissions allow. An example of why I would want to do this is to put save games in the Docs folder instead of 20 layers inside of the ProgramData folder, which would be the case if I used IsolatedStorage.
I have some old windows code that used to work but I cannot find anyway replace StorageFolder which no longer exists. So does anyone have an alternative to StorageFolder, other than using IsolatedStorage?
` public static async Task writeStringToFile( string p_PathAndFile, String p_StringToWrite )
{
// If there is no data then we exit:
if( p_PathAndFile == null || p_StringToWrite == null )
return;
StorageFolder storageFolder = ApplicationData.Current.LocalFolder;
Stream _TempStream = null;
StreamWriter _TempTextFile = null;
if (storageFolder != null) _TempStream = await storageFolder.OpenStreamForWriteAsync( p_PathAndFile, p_CreationOption );
if ( _TempStream != null )
{
_TempTextFile = new StreamWriter( _TempStream );
await _TempTextFile.WriteAsync( p_StringToWrite );
}
_TempTextFile.Dispose();
_TempStream.Dispose();
return;
}`