Remove Shell invocation as many as possible (high cost in term of speed of execution)
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit

This commit is contained in:
2022-09-02 15:57:20 +02:00
parent 8723019732
commit e3258453bb
15 changed files with 95 additions and 119 deletions

View File

@ -28,7 +28,7 @@ class StringsFileGenerator {
let stringsFilePath = "\(outputPath)/\(lang).lproj/\(inputFilenameWithoutExt).strings"
let stringsFilePathURL = URL(fileURLWithPath: stringsFilePath)
do {
try fileContent.write(to: stringsFilePathURL, atomically: true, encoding: .utf8)
try fileContent.write(to: stringsFilePathURL, atomically: false, encoding: .utf8)
} catch (let error) {
let error = StringiumError.writeFile(error.localizedDescription, stringsFilePath)
print(error.localizedDescription)
@ -115,19 +115,13 @@ class StringsFileGenerator {
return content
}()
// Create file if not exists
let fileManager = FileManager()
if fileManager.fileExists(atPath: extensionFilePath) == false {
Shell.shell(["touch", "\(extensionFilePath)"])
}
// Create extension content
let extensionFileContent = [extensionHeader, extensionContent, extensionFooter].joined(separator: "\n")
// Write content
let extensionFilePathURL = URL(fileURLWithPath: extensionFilePath)
do {
try extensionFileContent.write(to: extensionFilePathURL, atomically: true, encoding: .utf8)
try extensionFileContent.write(to: extensionFilePathURL, atomically: false, encoding: .utf8)
} catch (let error) {
let error = StringiumError.writeFile(extensionFilePath, error.localizedDescription)
print(error.localizedDescription)

View File

@ -35,19 +35,13 @@ class TagsGenerator {
return content
}()
// Create file if not exists
let fileManager = FileManager()
if fileManager.fileExists(atPath: extensionFilePath) == false {
Shell.shell(["touch", "\(extensionFilePath)"])
}
// Create extension content
let extensionFileContent = [extensionHeader, extensionContent, extensionFooter].joined(separator: "\n")
// Write content
let extensionFilePathURL = URL(fileURLWithPath: extensionFilePath)
do {
try extensionFileContent.write(to: extensionFilePathURL, atomically: true, encoding: .utf8)
try extensionFileContent.write(to: extensionFilePathURL, atomically: false, encoding: .utf8)
} catch (let error) {
let error = StringiumError.writeFile(extensionFilePath, error.localizedDescription)
print(error.localizedDescription)

View File

@ -53,7 +53,6 @@ class Definition {
guard let match = match else { return }
if let range = Range(match.range, in: input), let last = input[range].last {
debugPrint("Found: \(input[range])")
switch last {
case "d", "u":
methodsParameters.append("Int")