plist-cil icon indicating copy to clipboard operation
plist-cil copied to clipboard

Save to XXX issue

Open abcjjy opened this issue 7 years ago • 2 comments

    public static void SaveAsASCII(NSArray root, FileInfo outFile)
        {
            string parent = outFile.DirectoryName;
            if (!Directory.Exists(parent))
                Directory.CreateDirectory(parent);
            using (Stream fous = outFile.Open(FileMode.OpenOrCreate, FileAccess.ReadWrite))
            using (StreamWriter w = new StreamWriter(fous, Encoding.ASCII))
            {
                w.Write(root.ToASCIIPropertyList());
            }
        }

It is not a full overwrite in case writing to an existing file and leaves an invalid file.

abcjjy avatar Dec 08 '17 12:12 abcjjy

Following line will fix

fous.SetLength(0);

abcjjy avatar Dec 08 '17 13:12 abcjjy

@abcjjy acknowledged, I'll take a look as soon as I can.

claunia avatar Dec 10 '17 01:12 claunia