Check if log file exists
This commit is contained in:
parent
e5804ac0c7
commit
a05ed4dfcd
@ -241,7 +241,9 @@ final class FileGenerator {
|
|||||||
func writeResults(to file: URL) {
|
func writeResults(to file: URL) {
|
||||||
guard !unreadableFiles.isEmpty || !unwritableFiles.isEmpty || !failedMinifications.isEmpty || !missingFiles.isEmpty || !copiedFiles.isEmpty || !minifiedFiles.isEmpty || !files.expected.isEmpty || !files.external.isEmpty else {
|
guard !unreadableFiles.isEmpty || !unwritableFiles.isEmpty || !failedMinifications.isEmpty || !missingFiles.isEmpty || !copiedFiles.isEmpty || !minifiedFiles.isEmpty || !files.expected.isEmpty || !files.external.isEmpty else {
|
||||||
do {
|
do {
|
||||||
try FileManager.default.removeItem(at: file)
|
if FileManager.default.fileExists(atPath: file.path) {
|
||||||
|
try FileManager.default.removeItem(at: file)
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
print(" Failed to delete file log: \(error)")
|
print(" Failed to delete file log: \(error)")
|
||||||
}
|
}
|
||||||
|
@ -457,7 +457,9 @@ final class GenerationResultsHandler {
|
|||||||
func writeResults(to file: URL) {
|
func writeResults(to file: URL) {
|
||||||
guard !missingFiles.isEmpty || !unreadableFiles.isEmpty || !unwritableFiles.isEmpty || !missingLinkedPages.isEmpty || !pageWarnings.isEmpty || !generatedFiles.isEmpty || !draftPages.isEmpty || !emptyPages.isEmpty else {
|
guard !missingFiles.isEmpty || !unreadableFiles.isEmpty || !unwritableFiles.isEmpty || !missingLinkedPages.isEmpty || !pageWarnings.isEmpty || !generatedFiles.isEmpty || !draftPages.isEmpty || !emptyPages.isEmpty else {
|
||||||
do {
|
do {
|
||||||
try FileManager.default.removeItem(at: file)
|
if FileManager.default.fileExists(atPath: file.path) {
|
||||||
|
try FileManager.default.removeItem(at: file)
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
print(" Failed to delete generation log: \(error)")
|
print(" Failed to delete generation log: \(error)")
|
||||||
}
|
}
|
||||||
|
@ -314,7 +314,9 @@ final class ImageGenerator {
|
|||||||
func writeResults(to file: URL) {
|
func writeResults(to file: URL) {
|
||||||
guard !missingImages.isEmpty || !unreadableImages.isEmpty || !failedImages.isEmpty || !unhandledImages.isEmpty || !imageWarnings.isEmpty || !generatedImages.isEmpty || !optimizedImages.isEmpty else {
|
guard !missingImages.isEmpty || !unreadableImages.isEmpty || !failedImages.isEmpty || !unhandledImages.isEmpty || !imageWarnings.isEmpty || !generatedImages.isEmpty || !optimizedImages.isEmpty else {
|
||||||
do {
|
do {
|
||||||
try FileManager.default.removeItem(at: file)
|
if FileManager.default.fileExists(atPath: file.path) {
|
||||||
|
try FileManager.default.removeItem(at: file)
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
print(" Failed to delete image log: \(error)")
|
print(" Failed to delete image log: \(error)")
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,9 @@ final class MetadataInfoLogger {
|
|||||||
func writeResults(to file: URL) {
|
func writeResults(to file: URL) {
|
||||||
guard !errors.isEmpty || !warnings.isEmpty || !unreadableMetadata.isEmpty || !unusedProperties.isEmpty || !invalidProperties.isEmpty || !unknownProperties.isEmpty || !missingProperties.isEmpty else {
|
guard !errors.isEmpty || !warnings.isEmpty || !unreadableMetadata.isEmpty || !unusedProperties.isEmpty || !invalidProperties.isEmpty || !unknownProperties.isEmpty || !missingProperties.isEmpty else {
|
||||||
do {
|
do {
|
||||||
try FileManager.default.removeItem(at: file)
|
if FileManager.default.fileExists(atPath: file.path) {
|
||||||
|
try FileManager.default.removeItem(at: file)
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
print(" Failed to delete metadata log: \(error)")
|
print(" Failed to delete metadata log: \(error)")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user