Check both log modification and size
This commit is contained in:
parent
dcede1455d
commit
cc3033e01e
|
@ -45,6 +45,7 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate, NSMenuDelegate {
|
||||||
var recentBoards = [String]()
|
var recentBoards = [String]()
|
||||||
var recentProgrammers = [String]()
|
var recentProgrammers = [String]()
|
||||||
var logModified = NSDate.distantPast() as NSDate
|
var logModified = NSDate.distantPast() as NSDate
|
||||||
|
var logSize = 0
|
||||||
var updateLogTimer : NSTimer?
|
var updateLogTimer : NSTimer?
|
||||||
|
|
||||||
let kVersionKey = "Version"
|
let kVersionKey = "Version"
|
||||||
|
@ -221,14 +222,21 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate, NSMenuDelegate {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var modified : AnyObject?
|
var modified : AnyObject?
|
||||||
if (url!.getResourceValue(&modified, forKey:NSURLAttributeModificationDateKey, error:nil)) {
|
var size : AnyObject?
|
||||||
if (modified as NSDate).compare(logModified) == .OrderedDescending {
|
if (!url!.getResourceValue(&modified, forKey:NSURLAttributeModificationDateKey, error:nil)) {
|
||||||
var enc : UInt = 0
|
return
|
||||||
let newText = NSString(contentsOfURL:url!, usedEncoding:&enc, error:nil)
|
}
|
||||||
editor.setString(newText)
|
if (!url!.getResourceValue(&size, forKey:NSURLFileSizeKey, error:nil)) {
|
||||||
editor.gotoLine(1000000000, column: 0, animated: true)
|
return
|
||||||
logModified = modified as NSDate
|
}
|
||||||
}
|
|
||||||
|
if (modified as NSDate).compare(logModified) == .OrderedDescending || (size as Int) != logSize {
|
||||||
|
var enc : UInt = 0
|
||||||
|
let newText = NSString(contentsOfURL:url!, usedEncoding:&enc, error:nil)
|
||||||
|
editor.setString(newText)
|
||||||
|
editor.gotoLine(1000000000, column: 0, animated: true)
|
||||||
|
logModified = modified as NSDate
|
||||||
|
logSize = size as Int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,6 +255,7 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate, NSMenuDelegate {
|
||||||
editor.setMode(UInt(ACEModeASCIIDoc))
|
editor.setMode(UInt(ACEModeASCIIDoc))
|
||||||
editor.alphaValue = 0.8
|
editor.alphaValue = 0.8
|
||||||
logModified = NSDate.distantPast() as NSDate
|
logModified = NSDate.distantPast() as NSDate
|
||||||
|
logSize = -1
|
||||||
mainEditor = selection
|
mainEditor = selection
|
||||||
updateLog(nil)
|
updateLog(nil)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user