mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-11 09:28:38 +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 fileString: String? {
|
||||||
var encoding: String.Encoding = .utf8
|
var encoding: String.Encoding = .utf8
|
||||||
return try? String(contentsOfFile: self, usedEncoding: &encoding)
|
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
|
case right
|
||||||
}
|
}
|
||||||
|
|
||||||
extension String {
|
|
||||||
var fileURL: URL {
|
|
||||||
return URL(fileURLWithPath: self)
|
|
||||||
}
|
|
||||||
|
|
||||||
var appleScript: NSAppleScript? {
|
|
||||||
return NSAppleScript(source: self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension URL {
|
extension URL {
|
||||||
var appleScript: NSAppleScript? {
|
var appleScript: NSAppleScript? {
|
||||||
guard FileManager.default.fileExists(atPath: path) else { return nil }
|
guard FileManager.default.fileExists(atPath: path) else { return nil }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user