Skip to content

Commit b082e64

Browse files
committed
fix to keep LastWriteTime value when setting ZoneID
1 parent 26b64d6 commit b082e64

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

Applications/Ice/Main/Sources/Internal/Ads/ZoneId.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public static SecurityZone Get(string src)
121121
/* --------------------------------------------------------------------- */
122122
public static void Set(string src, SecurityZone id)
123123
{
124-
var attr = new Entity(src).Attributes;
124+
var entity = new Entity(src);
125125

126126
try
127127
{
@@ -131,7 +131,10 @@ public static void Set(string src, SecurityZone id)
131131
writer.WriteLine($"[{SectionName}]");
132132
writer.WriteLine($"{KeyName}={id:D}");
133133
}
134-
finally { Io.SetAttributes(src, attr); }
134+
finally {
135+
Io.SetLastWriteTime(src, entity.LastWriteTime);
136+
Io.SetAttributes(src, entity.Attributes);
137+
}
135138
}
136139

137140
#endregion

Tests/Ice/Sources/ExtractTest.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
/* ------------------------------------------------------------------------- */
1818
namespace Cube.FileSystem.SevenZip.Ice.Tests;
1919

20+
using System;
2021
using System.Collections.Generic;
2122
using System.Linq;
2223
using System.Security;
@@ -46,9 +47,14 @@ class ExtractTest : VmFixture
4647
/// Tests the extraction.
4748
/// </summary>
4849
///
50+
/// <param name="check">Path to check if the process completed.</param>
51+
/// <param name="files">Source files to be extracted.</param>
52+
/// <param name="args">Program options.</param>
53+
/// <param name="settings">User settings for extracting.</param>
54+
///
4955
/* --------------------------------------------------------------------- */
5056
[TestCaseSource(nameof(TestCases))]
51-
public void Extract(string dest, IEnumerable<string> files, IEnumerable<string> args, ExtractionSettingValue settings)
57+
public void Extract(string check, IEnumerable<string> files, IEnumerable<string> args, ExtractionSettingValue settings)
5258
{
5359
settings.SaveDirectory = Get("Preset");
5460

@@ -73,7 +79,8 @@ public void Extract(string dest, IEnumerable<string> files, IEnumerable<string>
7379
Logger.Debug($"{vm.Elapsed}, {vm.Remaining}, {vm.Title}");
7480
}
7581

76-
Assert.That(Io.Exists(Get(dest)), Is.True, dest);
82+
var dest = new Entity(Get(check));
83+
Assert.That(dest.Exists, Is.True, check);
7784
}
7885

7986
#endregion

0 commit comments

Comments
 (0)