mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
fix: fixed swiftlint error that appears in the new version of swiftlint
This commit is contained in:
@@ -76,15 +76,15 @@ public class DB {
|
||||
|
||||
public func insert(key: String, value: Codable, ts: Bool = true, force: Bool = false) {
|
||||
self.values[key] = value
|
||||
guard let blobData = try? JSONEncoder().encode(value) else { return }
|
||||
guard let blobData = try? JSONEncoder().encode(value), let str = String(data: blobData, encoding: .utf8)else { return }
|
||||
|
||||
if ts {
|
||||
self.lldb?.insert("\(key)@\(Date().currentTimeSeconds())", value: String(decoding: blobData, as: UTF8.self))
|
||||
self.lldb?.insert("\(key)@\(Date().currentTimeSeconds())", value: str)
|
||||
}
|
||||
|
||||
if !force, let ts = self.writeTS[key], (Date().timeIntervalSince1970-ts.timeIntervalSince1970) < 30 { return }
|
||||
|
||||
self.lldb?.insert(key, value: String(decoding: blobData, as: UTF8.self))
|
||||
self.lldb?.insert(key, value: str)
|
||||
self.writeTS[key] = Date()
|
||||
}
|
||||
|
||||
|
||||
@@ -73,13 +73,13 @@ public class NextLog {
|
||||
let fileURL = fm.urls(for: .documentDirectory, in: .userDomainMask)[0].appendingPathComponent("log.txt")
|
||||
|
||||
if !fm.fileExists(atPath: fileURL.path) {
|
||||
try? "".data(using: .utf8)?.write(to: fileURL)
|
||||
try? Data("".utf8).write(to: fileURL)
|
||||
}
|
||||
|
||||
do {
|
||||
let handle = try FileHandle(forWritingTo: fileURL)
|
||||
handle.seekToEndOfFile()
|
||||
handle.write("----------------\n".data(using: .utf8)!)
|
||||
handle.write(Data("----------------\n".utf8))
|
||||
self.writer = FileHandlerOutputStream(handle)
|
||||
} catch let err {
|
||||
print("error to init file handler: \(err)")
|
||||
|
||||
@@ -58,7 +58,7 @@ public class Reachability {
|
||||
_ = unmanagedReachability.retain()
|
||||
return UnsafeRawPointer(unmanagedReachability.toOpaque())
|
||||
},
|
||||
release: { (info: UnsafeRawPointer) -> Void in
|
||||
release: { (info: UnsafeRawPointer) in
|
||||
Unmanaged<Reachability>.fromOpaque(info).release()
|
||||
},
|
||||
copyDescription: nil
|
||||
|
||||
Reference in New Issue
Block a user