diff --git a/NLog-user.config b/NLog-user.config
new file mode 100644
index 0000000..9b10655
--- /dev/null
+++ b/NLog-user.config
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/NLog.config b/NLog.config
index 2559bd8..350ac1f 100644
--- a/NLog.config
+++ b/NLog.config
@@ -4,6 +4,8 @@
+
+
@@ -15,6 +17,7 @@
+
diff --git a/Torch/Managers/FilesystemManager.cs b/Torch/Managers/FilesystemManager.cs
index 254c9a0..b51992e 100644
--- a/Torch/Managers/FilesystemManager.cs
+++ b/Torch/Managers/FilesystemManager.cs
@@ -4,12 +4,14 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using NLog;
using Torch.API;
namespace Torch.Managers
{
public class FilesystemManager : Manager
{
+ private static readonly Logger _log = LogManager.GetCurrentClassLogger();
///
/// Temporary directory for Torch that is cleared every time the program is started.
///
@@ -22,11 +24,20 @@ namespace Torch.Managers
public FilesystemManager(ITorchBase torchInstance) : base(torchInstance)
{
+ var tmp = Path.Combine(Path.GetTempPath(), "Torch");
var torch = new FileInfo(typeof(FilesystemManager).Assembly.Location).Directory.FullName;
- TempDirectory = Directory.CreateDirectory(Path.Combine(torch, "tmp")).FullName;
- TorchDirectory = torch;
+ if (Path.GetPathRoot(tmp) == Path.GetPathRoot(torch))
+ {
+ TempDirectory = tmp;
+ }
+ else
+ {
+ TempDirectory = Directory.CreateDirectory(Path.Combine(torch, "tmp")).FullName;
+ TorchDirectory = torch;
- ClearTemp();
+ _log.Info($"Clearing tmp directory at {TempDirectory}");
+ ClearTemp();
+ }
}
private void ClearTemp()
diff --git a/Torch/Managers/UpdateManager.cs b/Torch/Managers/UpdateManager.cs
index de2e73c..700de86 100644
--- a/Torch/Managers/UpdateManager.cs
+++ b/Torch/Managers/UpdateManager.cs
@@ -55,8 +55,6 @@ namespace Torch.Managers
_log.Info("Failed to fetch latest version.");
return;
}
-
- _log.Info($"Clearing tmp directory at {_fsManager.TempDirectory}");
if (job.Version > Torch.TorchVersion)
{
@@ -90,6 +88,9 @@ namespace Torch.Managers
{
foreach (var file in zip.Entries)
{
+ if(file.Name == "NLog-user.config" && File.Exists(Path.Combine(extractPath, file.FullName)))
+ continue;
+
_log.Debug($"Unzipping {file.FullName}");
var targetFile = Path.Combine(extractPath, file.FullName);
_fsManager.SoftDelete(extractPath, file.FullName);