How to get full path of StreamWriter
In my version of the framework, this seems to work:
string fullPath = ((FileStream)(streamWriter.BaseStream)).Name;
(Found by debugging.)
To get the full path from a relative path, use the Path.GetFullPath method.
For example:
string fileName = "relative/path.txt";
string fullPath = Path.GetFullPath(fileName);
Might be the directory 'relative' not exists. Either create it manually. Or create it programmatically as below
string fileName = @"relative\path.txt";
fileName = Path.GetFullPath(fileName);
Directory.CreateDirectory(Path.GetDirectoryName(fileName));
StreamWriter sw= new StreamWriter(fileName, true);