Skip to content

Commit

Permalink
Attempt to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ffried committed Sep 18, 2024
1 parent 6591b28 commit af09205
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Tests/AppInformationTests/AppInfoTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,22 @@ final class AppInfoTests: XCTestCase {
let data = try PropertyListSerialization.data(fromPropertyList: infoDict, format: .xml, options: 0)
try data.write(to: infoPlistURL, options: .atomic)
if let localizedInfoDict {
let locale = Locale.current.identifier
let lprojName: String
#if canImport(Darwin)
lprojName = Locale.current.identifier
#else
lprojName = Locale.current.languageCode ?? Locale.current.identifier
#endif
let lprojFolderURL = contentsURL
.appendingPathComponent("Resources", isDirectory: true)
.appendingPathComponent("\(locale).lproj", isDirectory: true)
.appendingPathComponent("\(lprojName).lproj", isDirectory: true)
try FileManager.default.createDirectory(at: lprojFolderURL, withIntermediateDirectories: true)
let stringsFile = lprojFolderURL.appendingPathComponent("InfoPlist.strings", isDirectory: false)
try localizedInfoDict
.lazy
.map { #""\#($0.key)" = "\#($0.value)";"# }
.joined(separator: "\n")
.write(to: stringsFile, atomically: true, encoding: .utf16)
.write(to: stringsFile, atomically: true, encoding: .utf8)
}
}

Expand Down

0 comments on commit af09205

Please sign in to comment.