diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-02-12 07:22:53 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-02-12 07:22:53 -0800 |
commit | a6ccdd89c214ee2837b05985e7bf582a24b40c49 (patch) | |
tree | cd3f1b68dc77108d5f4051a766230312805d0c8a | |
parent | b907ec5103262c99a1abc88ea931a3cd22ead45d (diff) | |
download | DotNetOpenAuth-a6ccdd89c214ee2837b05985e7bf582a24b40c49.zip DotNetOpenAuth-a6ccdd89c214ee2837b05985e7bf582a24b40c49.tar.gz DotNetOpenAuth-a6ccdd89c214ee2837b05985e7bf582a24b40c49.tar.bz2 |
CopyWithTokenSubstitution now creates missing directories more reliably.
-rw-r--r-- | src/DotNetOpenAuth.BuildTasks/CopyWithTokenSubstitution.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/DotNetOpenAuth.BuildTasks/CopyWithTokenSubstitution.cs b/src/DotNetOpenAuth.BuildTasks/CopyWithTokenSubstitution.cs index 38f3b50..e973962 100644 --- a/src/DotNetOpenAuth.BuildTasks/CopyWithTokenSubstitution.cs +++ b/src/DotNetOpenAuth.BuildTasks/CopyWithTokenSubstitution.cs @@ -58,6 +58,10 @@ namespace DotNetOpenAuth.BuildTasks { string destPath = this.DestinationFiles[i].ItemSpec; bool skipUnchangedFiles = bool.Parse(this.SourceFiles[i].GetMetadata("SkipUnchangedFiles")); + if (!Directory.Exists(Path.GetDirectoryName(destPath))) { + Directory.CreateDirectory(Path.GetDirectoryName(destPath)); + } + if (string.IsNullOrEmpty(this.SourceFiles[i].GetMetadata("BeforeTokens"))) { // this is just a standard copy without token substitution if (skipUnchangedFiles && File.GetLastWriteTimeUtc(sourcePath) == File.GetLastWriteTimeUtc(destPath)) { @@ -85,9 +89,6 @@ namespace DotNetOpenAuth.BuildTasks { } using (StreamReader sr = File.OpenText(sourcePath)) { - if (!Directory.Exists(Path.GetDirectoryName(destPath))) { - Directory.CreateDirectory(Path.GetDirectoryName(destPath)); - } using (StreamWriter sw = File.CreateText(destPath)) { StringBuilder line = new StringBuilder(); while (!sr.EndOfStream) { |