Permalink
Browse files

Allow configuring the snippet compiler to preserve temp files.

  • Loading branch information...
1 parent d497694 commit 3ea3c2b835ad6b6c52982cc58f305ce9ab7de2b2 @kg kg committed May 31, 2012
Showing with 7 additions and 3 deletions.
  1. +4 −2 Try/SnippetCompiler.cs
  2. +3 −1 jsil.org/try/compile.aspx.cs
View
@@ -180,7 +180,7 @@ public static class SnippetCompiler {
/// Compiles the provided C# and then translates it into JavaScript.
/// On success, returns the JS. On failure, throws.
/// </summary>
- public static CompiledSnippet Compile (string csharp) {
+ public static CompiledSnippet Compile (string csharp, bool deleteTempFiles) {
var result = new CompiledSnippet {
OriginalSource = csharp
};
@@ -324,8 +324,10 @@ public static class SnippetCompiler {
return result;
} finally {
+
try {
- Directory.Delete(tempPath, true);
+ if (deleteTempFiles)
+ Directory.Delete(tempPath, true);
} catch (Exception exc) {
Console.WriteLine("Failed to empty temporary directory: {0}", exc.Message);
}
@@ -39,9 +39,11 @@ public static class Program {
requestBody = sr.ReadToEnd();
}
+ bool deleteTempFiles = true;
+
try {
string entryPointName, warnings;
- var result = JSIL.Try.SnippetCompiler.Compile(requestBody);
+ var result = JSIL.Try.SnippetCompiler.Compile(requestBody, deleteTempFiles);
WriteResponseJSON(new {
ok = true,

0 comments on commit 3ea3c2b

Please sign in to comment.