Skip to content

Commit d792013

Browse files
fatbobmanclaude
andcommitted
clean: remove debug output from ZIP structure fix
Removed all temporary debugging output added during the ZIP structure investigation. The fix has been verified to work correctly: - XLSX files now have proper internal structure when unzipped - No unwanted directory layers (like random hex strings) appear - All working directory strategies (.alongsideOutput, .systemTemp, .custom) work correctly - All existing tests continue to pass The core fix (URL symlink resolution in SimpleZip.collectEntries) remains intact. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a1c43f0 commit d792013

File tree

3 files changed

+1
-64
lines changed

3 files changed

+1
-64
lines changed

Sources/Objects2XLSX/Book/Book.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -612,11 +612,6 @@ public final class Book {
612612

613613
logger.info("Created XLSX directory structure at: \(tempDir.path)")
614614

615-
// 调试:列出临时目录内容
616-
if let contents = try? FileManager.default.contentsOfDirectory(atPath: tempDir.path) {
617-
print("📁 TempDir contents: \(contents)")
618-
}
619-
620615
} catch {
621616
throw BookError.fileWriteError(error)
622617
}
@@ -734,10 +729,6 @@ public final class Book {
734729
/// - outputURL: Target URL for the final XLSX file
735730
/// - Throws: BookError.fileWriteError if ZIP creation fails
736731
func createZipArchive(from tempDir: URL, to outputURL: URL) throws(BookError) {
737-
print("📦 Book.createZipArchive called:")
738-
print(" TempDir: \(tempDir.path)")
739-
print(" OutputURL: \(outputURL.path)")
740-
741732
do {
742733
let stats = try zipArchiver.createArchiveWithStats(from: tempDir, to: outputURL)
743734

Sources/Objects2XLSX/Utils/SimpleZip.swift

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -278,15 +278,9 @@ public struct SimpleZip: Sendable {
278278
*/
279279
@discardableResult
280280
public static func createFromDirectoryWithStats(directoryURL: URL, outputURL: URL) throws -> CompressionStats {
281-
print("🚀 ZIP createFromDirectoryWithStats called:")
282-
print(" From: \(directoryURL.path)")
283-
print(" To: \(outputURL.path)")
284-
285281
let entries = try collectEntries(from: directoryURL)
286282
let (zipData, stats) = try createWithStats(entries: entries)
287283
try zipData.write(to: outputURL)
288-
289-
print("✅ ZIP creation completed successfully")
290284
return stats
291285
}
292286

@@ -301,8 +295,6 @@ public struct SimpleZip: Sendable {
301295
let fileManager = FileManager.default
302296
var entries: [Entry] = []
303297

304-
print("🔧 ZIP collectEntries started from: \(directoryURL.path)")
305-
306298
let enumerator = fileManager.enumerator(
307299
at: directoryURL,
308300
includingPropertiesForKeys: [.isRegularFileKey, .contentModificationDateKey],
@@ -323,21 +315,9 @@ public struct SimpleZip: Sendable {
323315
if resolvedFileURL.path.hasPrefix(resolvedDirectoryURL.path) {
324316
let basePath = resolvedDirectoryURL.path.hasSuffix("/") ? resolvedDirectoryURL.path : resolvedDirectoryURL.path + "/"
325317
relativePath = String(resolvedFileURL.path.dropFirst(basePath.count))
326-
// 强制输出调试信息(移除 DEBUG 条件)
327-
print("✅ ZIP Path calculation success:")
328-
print(" Directory: \(resolvedDirectoryURL.path)")
329-
print(" File: \(resolvedFileURL.path)")
330-
print(" Relative: \(relativePath)")
331318
} else {
332319
// Fallback to just filename if path calculation fails
333320
relativePath = fileURL.lastPathComponent
334-
// 强制输出调试信息(移除 DEBUG 条件)
335-
print("❌ ZIP Path calculation failed:")
336-
print(" Directory original: \(directoryURL.path)")
337-
print(" Directory resolved: \(resolvedDirectoryURL.path)")
338-
print(" File original: \(fileURL.path)")
339-
print(" File resolved: \(resolvedFileURL.path)")
340-
print(" Fallback to: \(relativePath)")
341321
}
342322
let data = try Data(contentsOf: fileURL)
343323
let modificationDate = resourceValues.contentModificationDate ?? Date()
@@ -347,12 +327,7 @@ public struct SimpleZip: Sendable {
347327
}
348328

349329
// Sort entries by path for consistent output
350-
let sortedEntries = entries.sorted { $0.path < $1.path }
351-
print("📦 ZIP collectEntries completed: \(sortedEntries.count) files")
352-
for entry in sortedEntries {
353-
print(" 📄 \(entry.path)")
354-
}
355-
return sortedEntries
330+
return entries.sorted { $0.path < $1.path }
356331
}
357332
}
358333

debug_paths.swift

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)