aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/ZipArchive
diff options
context:
space:
mode:
Diffstat (limited to 'WireGuard/WireGuard/ZipArchive')
-rw-r--r--WireGuard/WireGuard/ZipArchive/ZipExporter.swift2
-rw-r--r--WireGuard/WireGuard/ZipArchive/ZipImporter.swift12
2 files changed, 7 insertions, 7 deletions
diff --git a/WireGuard/WireGuard/ZipArchive/ZipExporter.swift b/WireGuard/WireGuard/ZipArchive/ZipExporter.swift
index 4f57613..f875e1b 100644
--- a/WireGuard/WireGuard/ZipArchive/ZipExporter.swift
+++ b/WireGuard/WireGuard/ZipArchive/ZipExporter.swift
@@ -16,7 +16,7 @@ enum ZipExporterError: WireGuardAppError {
class ZipExporter {
static func exportConfigFiles(tunnelConfigurations: [TunnelConfiguration], to url: URL,
- completion: @escaping (WireGuardAppError?) -> Void) {
+ completion: @escaping (WireGuardAppError?) -> Void) {
guard (!tunnelConfigurations.isEmpty) else {
completion(ZipExporterError.noTunnelsToExport)
diff --git a/WireGuard/WireGuard/ZipArchive/ZipImporter.swift b/WireGuard/WireGuard/ZipArchive/ZipImporter.swift
index 6c1e3de..194dc0e 100644
--- a/WireGuard/WireGuard/ZipArchive/ZipImporter.swift
+++ b/WireGuard/WireGuard/ZipArchive/ZipImporter.swift
@@ -20,13 +20,13 @@ class ZipImporter {
var unarchivedFiles: [(fileBaseName: String, contents: Data)]
do {
unarchivedFiles = try ZipArchive.unarchive(url: url, requiredFileExtensions: ["conf"])
- for (i, unarchivedFile) in unarchivedFiles.enumerated().reversed() {
+ for (index, unarchivedFile) in unarchivedFiles.enumerated().reversed() {
let fileBaseName = unarchivedFile.fileBaseName
let trimmedName = fileBaseName.trimmingCharacters(in: .whitespacesAndNewlines)
if (!trimmedName.isEmpty) {
- unarchivedFiles[i].fileBaseName = trimmedName
+ unarchivedFiles[index].fileBaseName = trimmedName
} else {
- unarchivedFiles.remove(at: i)
+ unarchivedFiles.remove(at: index)
}
}
@@ -42,8 +42,8 @@ class ZipImporter {
unarchivedFiles.sort { $0.fileBaseName < $1.fileBaseName }
var configs = Array<TunnelConfiguration?>(repeating: nil, count: unarchivedFiles.count)
- for (i, file) in unarchivedFiles.enumerated() {
- if (i > 0 && file == unarchivedFiles[i - 1]) {
+ for (index, file) in unarchivedFiles.enumerated() {
+ if (index > 0 && file == unarchivedFiles[index - 1]) {
continue
}
guard let fileContents = String(data: file.contents, encoding: .utf8) else {
@@ -52,7 +52,7 @@ class ZipImporter {
guard let tunnelConfig = try? WgQuickConfigFileParser.parse(fileContents, name: file.fileBaseName) else {
continue
}
- configs[i] = tunnelConfig
+ configs[index] = tunnelConfig
}
DispatchQueue.main.async { completion(.success(configs)) }
}