Currently, if the "results" folder is not written ahead of time, PhotonDatabaseWriter will throw an exception when attempting to write to a file within the specified folder. When consuming the Vts library, it is not obvious that this folder must exist before a simulation is run, and leads to exceptions that a consumer of the library should not have to debug/fix.
In order to fix this, add the following guard to the top of CustomBinaryStreamWriter<T>.OpenStream():
try
{
// guard against directory not existing ahead of time
var directory = Path.GetDirectoryName(_filename);
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
...
}
Currently, if the "results" folder is not written ahead of time,
PhotonDatabaseWriter
will throw an exception when attempting to write to a file within the specified folder. When consuming the Vts library, it is not obvious that this folder must exist before a simulation is run, and leads to exceptions that a consumer of the library should not have to debug/fix.In order to fix this, add the following guard to the top of
CustomBinaryStreamWriter<T>.OpenStream()
: