mirror of
https://github.com/claunia/plist-cil.git
synced 2025-12-16 19:14:26 +00:00
Merge pull request #11 from quamotion/fixes/create-new-file
Always create a new file when writing to disk.
This commit is contained in:
@@ -214,7 +214,10 @@ namespace Claunia.PropertyList
|
|||||||
string parent = outFile.DirectoryName;
|
string parent = outFile.DirectoryName;
|
||||||
if (!Directory.Exists(parent))
|
if (!Directory.Exists(parent))
|
||||||
Directory.CreateDirectory(parent);
|
Directory.CreateDirectory(parent);
|
||||||
using (Stream fous = outFile.Open(FileMode.OpenOrCreate, FileAccess.ReadWrite))
|
|
||||||
|
// Use Create here -- to make sure that when the updated file is shorter than
|
||||||
|
// the original file, no "obsolete" data is left at the end.
|
||||||
|
using (Stream fous = outFile.Open(FileMode.Create, FileAccess.ReadWrite))
|
||||||
{
|
{
|
||||||
SaveAsXml(root, fous);
|
SaveAsXml(root, fous);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user