Create directory if not exists when saving settings

This commit is contained in:
Michael Delpach 2016-01-27 16:20:36 +08:00
parent 6d17b2e75d
commit df60a0db7e

View file

@ -59,6 +59,8 @@ public static bool Save(object obj, string filePath, SerializationType type, boo
{
string tempFilePath = filePath + ".temp";
Helpers.CreateDirectoryIfNotExist(filePath, true);
using (FileStream fs = new FileStream(tempFilePath, FileMode.Create, FileAccess.Write, FileShare.Read))
{
Save(obj, fs, type);