mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-10 00:58:37 +00:00
Consolidate the two String extenstions.
This commit is contained in:
parent
fa413f2fa2
commit
2cdb705b37
@ -730,6 +730,13 @@ extension String {
|
||||
var fileString: String? {
|
||||
var encoding: String.Encoding = .utf8
|
||||
return try? String(contentsOfFile: self, usedEncoding: &encoding)
|
||||
|
||||
var fileURL: URL {
|
||||
return URL(fileURLWithPath: self)
|
||||
}
|
||||
|
||||
var appleScript: NSAppleScript? {
|
||||
return NSAppleScript(source: self)
|
||||
}
|
||||
}
|
||||
|
||||
@ -749,16 +756,6 @@ enum Align: String, Decodable {
|
||||
case right
|
||||
}
|
||||
|
||||
extension String {
|
||||
var fileURL: URL {
|
||||
return URL(fileURLWithPath: self)
|
||||
}
|
||||
|
||||
var appleScript: NSAppleScript? {
|
||||
return NSAppleScript(source: self)
|
||||
}
|
||||
}
|
||||
|
||||
extension URL {
|
||||
var appleScript: NSAppleScript? {
|
||||
guard FileManager.default.fileExists(atPath: path) else { return nil }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user