Skip to content

Commit b9cd018

Browse files
committed
Add --cache-folder arg
1 parent 69f2d8b commit b9cd018

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

clonezilla-util/CL/Verbs/BaseVerb.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ public class BaseVerb
1010
[Option('i', "input", HelpText = "The folder containing the Clonezilla archive. Or, a partclone filename, or image filename.", Required = true, Min = 1)]
1111
public IEnumerable<string>? InputPaths { get; set; }
1212

13+
[Option("cache-folder", HelpText = "The folder to store cache files. Defaults to the 'cache' folder in the same location as the exe.", Required = false)]
14+
public string? CacheFolder { get; set; }
15+
1316
[Option("temp-folder", HelpText = "The folder to store temporary files (if required)", Required = false)]
1417
public string? TempFolder { get; set; }
1518

clonezilla-util/Program.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace clonezilla_util
2020
public class Program
2121
{
2222
const string PROGRAM_NAME = "clonezilla-util";
23-
const string PROGRAM_VERSION = "2.5.1";
23+
const string PROGRAM_VERSION = "2.5.2";
2424

2525
private enum ReturnCode
2626
{
@@ -29,7 +29,7 @@ private enum ReturnCode
2929
GeneralException = 2,
3030
}
3131

32-
static readonly string CacheFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "cache");
32+
static string CacheFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "cache");
3333

3434
//To get the binary to work when using 'Trim unused code', had to add the TrimMode:
3535
// <PublishTrimmed>true</PublishTrimmed>
@@ -55,8 +55,6 @@ public static int Main(string[] args)
5555
.WriteTo.File(@"logs\clonezilla-util-.log", rollingInterval: RollingInterval.Day, restrictedToMinimumLevel: LogEventLevel.Information)
5656
.CreateLogger();
5757

58-
WholeFileCacheManager.Initialize(CacheFolder);
59-
6058
Log.Debug("Start");
6159
PrintProgramVersion();
6260

@@ -91,8 +89,15 @@ private static void Run(object obj)
9189
{
9290
TempUtility.TempRoot = baseVerb.TempFolder;
9391
}
92+
93+
if (baseVerb.CacheFolder != null)
94+
{
95+
CacheFolder = baseVerb.CacheFolder;
96+
}
9497
}
9598

99+
WholeFileCacheManager.Initialize(CacheFolder);
100+
96101
switch (obj)
97102
{
98103
case ListContents listContentsOptions:

0 commit comments

Comments
 (0)