Nemerle.VisualStudio.Project.NemerleProjectNode.AddFileFromTemplate C# (CSharp) Method

AddFileFromTemplate() public method

Overriding to provide customization of files on add files. This will replace tokens in the file with actual value (namespace, class name,...)
public AddFileFromTemplate ( string source, string target ) : void
source string Full path to template file
target string Full path to destination file
return void
        public override void AddFileFromTemplate(string source, string target)
        {
            if (!File.Exists(source))
                throw new FileNotFoundException(
                    String.Format("Template file not found: {0}", source));

            // We assume that there is no token inside the file because the only
            // way to add a new element should be through the template wizard that
            // take care of expanding and replacing the tokens.
            // The only task to perform is to copy the source file in the
            // target location.
            string targetFolder = Path.GetDirectoryName(target);
            if (!Directory.Exists(targetFolder))
            {
                Directory.CreateDirectory(targetFolder);
            }

            File.Copy(source, target);
        }