From af092057a47b752bb81b5b066a5922f730df18c3 Mon Sep 17 00:00:00 2001 From: Florian Friedrich Date: Wed, 18 Sep 2024 14:52:21 +0200 Subject: [PATCH] Attempt to fix tests --- Tests/AppInformationTests/AppInfoTests.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Tests/AppInformationTests/AppInfoTests.swift b/Tests/AppInformationTests/AppInfoTests.swift index f465508..dac74c4 100644 --- a/Tests/AppInformationTests/AppInfoTests.swift +++ b/Tests/AppInformationTests/AppInfoTests.swift @@ -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) } }