mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
Configure aria2c Progress better
Using .file kind and .downloading file operation kind will produce a more appropriate localizedAdditionalDescription. The fileTotalCount and fileCompletedCount aren't appropriate for this case, because there's only one file being downloaded.
This commit is contained in:
parent
d00a356c29
commit
e301ad8818
2 changed files with 3 additions and 3 deletions
|
|
@ -53,7 +53,9 @@ public struct Shell {
|
|||
let stdErrPipe = Pipe()
|
||||
process.standardError = stdErrPipe
|
||||
|
||||
var progress = Progress(totalUnitCount: 100)
|
||||
var progress = Progress()
|
||||
progress.kind = .file
|
||||
progress.fileOperationKind = .downloading
|
||||
|
||||
let observer = NotificationCenter.default.addObserver(
|
||||
forName: .NSFileHandleDataAvailable,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ extension Progress {
|
|||
if let match = regexTotalDownloaded.firstMatch(in: string, options: [], range: range),
|
||||
let matchRange = Range(match.range(at: 0), in: string),
|
||||
let totalDownloaded = Int(string[matchRange].replacingOccurrences(of: "B", with: "")) {
|
||||
self.fileCompletedCount = totalDownloaded
|
||||
self.completedUnitCount = Int64(totalDownloaded)
|
||||
}
|
||||
|
||||
|
|
@ -24,7 +23,6 @@ extension Progress {
|
|||
let totalFileSize = Int(string[matchRange].replacingOccurrences(of: "B", with: "")) {
|
||||
|
||||
if totalFileSize > 0 {
|
||||
self.fileTotalCount = totalFileSize
|
||||
self.totalUnitCount = Int64(totalFileSize)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue