mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Set OakDocument’s ‘onDisk’ property during initialization
The old implementation in document_t would check the status in the getter when the document wasn’t open, since we only observe the disk for open documents. Such solution though would not support key/value observing. We could improve performance slightly by accepting an “isOnDisk” flag in the initializer since when we create documents from scanning the disk (folder search and file chooser) we already know the document is on disk and thus could skip the extra disk access.
This commit is contained in:
@@ -319,7 +319,8 @@ private:
|
||||
{
|
||||
if(self = [self init])
|
||||
{
|
||||
_path = aPath;
|
||||
_path = aPath;
|
||||
_onDisk = access([_path fileSystemRepresentation], F_OK) == 0;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -355,6 +356,7 @@ private:
|
||||
_backupPath = to_ns(path);
|
||||
|
||||
_path = to_ns(path::resolve(path::get_attr(path, "com.macromates.backup.path")));
|
||||
_onDisk = access([_path fileSystemRepresentation], F_OK) == 0;
|
||||
_fileType = to_ns(path::get_attr(path, "com.macromates.backup.file-type"));
|
||||
_diskEncoding = to_ns(path::get_attr(path, "com.macromates.backup.encoding"));
|
||||
_diskNewlines = to_ns(path::get_attr(path, "com.macromates.backup.newlines"));
|
||||
|
||||
Reference in New Issue
Block a user