Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Use a different temp directory to the typical Squirrel
Browse files Browse the repository at this point in the history
  • Loading branch information
caesay committed Dec 20, 2021
1 parent 4871548 commit d06238f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Squirrel/Internal/Utility.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.Contracts;
Expand Down Expand Up @@ -307,8 +307,16 @@ internal static string tempNameForIndex(int index, string prefix)

public static DirectoryInfo GetTempDirectory(string localAppDirectory)
{
var tempDir = Environment.GetEnvironmentVariable("SQUIRREL_TEMP");
tempDir = tempDir ?? Path.Combine(localAppDirectory ?? Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "SquirrelTemp");
#if DEBUG
const string TEMP_ENV_VAR = "CLOWD_SQUIRREL_TEMP_DEBUG";
const string TEMP_DIR_NAME = "SquirrelClowdTempDebug";
#else
const string TEMP_ENV_VAR = "CLOWD_SQUIRREL_TEMP";
const string TEMP_DIR_NAME = "SquirrelClowdTemp";
#endif

var tempDir = Environment.GetEnvironmentVariable(TEMP_ENV_VAR);
tempDir = tempDir ?? Path.Combine(localAppDirectory ?? Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), TEMP_DIR_NAME);

var di = new DirectoryInfo(tempDir);
if (!di.Exists) di.Create();
Expand Down

0 comments on commit d06238f

Please sign in to comment.