upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tools/rpf9dump/Program.cs
diff options
context:
space:
mode:
authorkirigayakazima <46666711+kirigayakazima@users.noreply.github.com>2026-12-01 19:17:10 +0800
committerkirigayakazima <46666711+kirigayakazima@users.noreply.github.com>2026-12-01 19:17:10 +0800
commitb13b6b3d3f75335862b1c1c33c33b2fa6d7da02c (patch)
treea96c72815df485e7479a1aef8e02e36d37042f44 /tools/rpf9dump/Program.cs
parentc28b21aa6151a3f572d4b8ab066c96fe8fe72f94 (diff)
parent3ee508b469012606cf90f6efe7bec5ef65c446e7 (diff)
Merge remote-tracking branch 'upstream/main' into HEAD
Diffstat (limited to 'tools/rpf9dump/Program.cs')
-rw-r--r--tools/rpf9dump/Program.cs16
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/rpf9dump/Program.cs b/tools/rpf9dump/Program.cs
index 17e81a423..c89f08e0e 100644
--- a/tools/rpf9dump/Program.cs
+++ b/tools/rpf9dump/Program.cs
@@ -87,7 +87,7 @@ if (mode == "ttpf")
87 string path = Path.Combine(outDir, name); 87 string path = Path.Combine(outDir, name);
88 string? file = t.CanExtract ? name : null, limitation = t.Limitation; 88 string? file = t.CanExtract ? name : null, limitation = t.Limitation;
89 if (!t.CanExtract) Interlocked.Increment(ref skip); 89 if (!t.CanExtract) Interlocked.Increment(ref skip);
90 else if (File.Exists(path)) Interlocked.Increment(ref ok); 90 else if (HasNonemptyDds(path)) Interlocked.Increment(ref ok);
91 else 91 else
92 { 92 {
93 try 93 try
@@ -403,6 +403,20 @@ else if (mode is "models" or "textures")
403Console.WriteLine($"{mode} {baseName}: ok={ok} fail={fail} skip={skip} in {sw.Elapsed.TotalSeconds:0}s"); 403Console.WriteLine($"{mode} {baseName}: ok={ok} fail={fail} skip={skip} in {sw.Elapsed.TotalSeconds:0}s");
404return (mode == "ttpf" && fail != 0) || writeFail != 0 ? 1 : 0; 404return (mode == "ttpf" && fail != 0) || writeFail != 0 ? 1 : 0;
405 405
406static bool HasNonemptyDds(string path)
407{
408 try
409 {
410 FileSystemInfo output = new FileInfo(path);
411 if (!output.Exists) return false;
412 // FileInfo.Length can report the link's length instead of its target's length.
413 if ((output.Attributes & FileAttributes.ReparsePoint) != 0)
414 output = output.ResolveLinkTarget(returnFinalTarget: true) ?? output;
415 return output is FileInfo file && file.Exists && file.Length > 0;
416 }
417 catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) { return false; }
418}
419
406// A stale marker may be read-only from an earlier interrupted run; clear the attribute so the withdraw works. 420// A stale marker may be read-only from an earlier interrupted run; clear the attribute so the withdraw works.
407static void WithdrawMarker(string path) 421static void WithdrawMarker(string path)
408{ 422{