Skip to content

Commit

Permalink
only save entries if they are non-empty
Browse files Browse the repository at this point in the history
  • Loading branch information
g-Off committed Nov 29, 2018
1 parent 451be24 commit 41ab2b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/stringray/Commands/Command.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protocol Command {

extension Command {
func write(to url: Foundation.URL, table: StringsTable) throws {
for (languageId, languageEntries) in table.entries {
for (languageId, languageEntries) in table.entries where !languageEntries.isEmpty {
let fileURL = try url.stringsURL(tableName: table.name, locale: languageId)
guard let outputStream = OutputStream(url: fileURL, append: false) else { continue }
outputStream.open()
Expand All @@ -33,7 +33,7 @@ extension Command {
outputStream.close()
}

for (languageId, languageEntries) in table.dictEntries {
for (languageId, languageEntries) in table.dictEntries where !languageEntries.isEmpty {
let fileURL = try url.stringsDictURL(tableName: table.name, locale: languageId)
let encoder = PropertyListEncoder()
encoder.outputFormat = .xml
Expand Down

0 comments on commit 41ab2b5

Please sign in to comment.