mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-19 01:51:09 +00:00
re-set modification date on save, show alert panel
This commit is contained in:
parent
a6fc84bc9b
commit
2ace3c327a
1 changed files with 14 additions and 2 deletions
|
@ -670,7 +670,16 @@
|
||||||
// Check if the file was ever written and its time is the same as the current file modification date
|
// Check if the file was ever written and its time is the same as the current file modification date
|
||||||
if (!(_lastSaveDate && [fileModDate isEqualToDate:_lastSaveDate]))
|
if (!(_lastSaveDate && [fileModDate isEqualToDate:_lastSaveDate]))
|
||||||
{
|
{
|
||||||
PCLogInfo(self, @"File modified externally?");
|
NSInteger choice;
|
||||||
|
|
||||||
|
PCLogInfo(self, @"File modified externally. %@ - %@", _lastSaveDate, fileModDate);
|
||||||
|
choice = NSRunAlertPanel(@"Overwrite File?",
|
||||||
|
@"File %@ was modified externally. Overwrite?",
|
||||||
|
@"Cancel", nil, @"Proceed", [_path lastPathComponent]);
|
||||||
|
if (choice == NSAlertDefaultReturn)
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
@ -681,6 +690,10 @@
|
||||||
|
|
||||||
if (saved == YES)
|
if (saved == YES)
|
||||||
{
|
{
|
||||||
|
[self setIsEdited:NO];
|
||||||
|
|
||||||
|
// re-read date just saved
|
||||||
|
ASSIGN(_lastSaveDate, [[fm fileAttributesAtPath:_path traverseLink:NO] fileModificationDate]);
|
||||||
// Send the notification to Gorm...
|
// Send the notification to Gorm...
|
||||||
if([[_path pathExtension] isEqual: @"h"])
|
if([[_path pathExtension] isEqual: @"h"])
|
||||||
{
|
{
|
||||||
|
@ -689,7 +702,6 @@
|
||||||
object: _path];
|
object: _path];
|
||||||
}
|
}
|
||||||
|
|
||||||
[self setIsEdited:NO];
|
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
postNotificationName:PCEditorDidSaveNotification
|
postNotificationName:PCEditorDidSaveNotification
|
||||||
object:self];
|
object:self];
|
||||||
|
|
Loading…
Reference in a new issue