Make file writable and copy

image_pdfimage_print
   
 

// HtmlAgilityPack V1.0 - Simon Mourier <simon underscore mourier at hotmail dot com>
using System;
using System.IO;

namespace HtmlAgilityPack
{
    internal struct IOLibrary
    {
        internal static void MakeWritable(string path)
        {
            if (!File.Exists(path))
                return;
            File.SetAttributes(path, File.GetAttributes(path) &amp; ~FileAttributes.ReadOnly);
        }

        internal static void CopyAlways(string source, string target)
        {
            if (!File.Exists(source))
                return;
            Directory.CreateDirectory(Path.GetDirectoryName(target));
            MakeWritable(target);
            File.Copy(source, target, true);
        }
    }

}

   
     


This entry was posted in File Stream. Bookmark the permalink.