diff --git a/.gitignore b/.gitignore index 49ea30a4..5de5fb44 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,5 @@ x64/ _NCrunch_WebCompiler#Node #Node -src/WebCompiler/Node/node_modules/* \ No newline at end of file +src/WebCompiler/Node/node_modules/* +src/WebCompiler/Node/node.exe \ No newline at end of file diff --git a/src/WebCompiler/Compile/CompilerService.cs b/src/WebCompiler/Compile/CompilerService.cs index 119b7ff0..4f53bf9f 100644 --- a/src/WebCompiler/Compile/CompilerService.cs +++ b/src/WebCompiler/Compile/CompilerService.cs @@ -11,12 +11,19 @@ namespace WebCompiler public static class CompilerService { internal const string Version = "1.4.167"; - private static readonly string _path = Path.Combine(Path.GetTempPath(), "WebCompiler" + Version); + internal const string WorkingDirectoryEnvVarName = "WEBCOMPILER_WORKING_DIRECTORY"; + private static readonly string _path = GetWorkingDirectoryPath(); private static object _syncRoot = new object(); // Used to lock on the initialize step /// A list of allowed file extensions. public static readonly string[] AllowedExtensions = new[] { ".LESS", ".SCSS", ".SASS", ".STYL", ".COFFEE", ".ICED", ".JS", ".JSX", ".ES6", ".HBS", ".HANDLEBARS" }; + internal static string GetWorkingDirectoryPath() + { + var envValue = Environment.GetEnvironmentVariable(WorkingDirectoryEnvVarName); + return Path.Combine(envValue ?? Path.GetTempPath(), "WebCompiler" + Version); + } + /// /// Test if a file type is supported by the compilers. ///