Opening folder after session restore would not see it as open

When opening a folder we test against the ‘projectPath’ property (on already open window controllers), but this is not setup until we have an open document, and documents are opened using a background queue, so code running in the same event loop cycle as the session restore, will not get the proper value for this property.

The problem this fixes is: open /path/to/foo and quit TextMate. Now drag /path/to/foo to TextMate’s app icon. TextMate would first restore session (which includes /path/to/foo) and then open /path/to/foo (not seeing the restored folder as being /path/to/foo due to the uninitialized ‘projectPath’ property).
This commit is contained in:
Allan Odgaard
2014-08-15 17:39:36 +02:00
parent 54270827ff
commit ffa628f328

View File

@@ -2698,7 +2698,7 @@ static NSUInteger DisableSessionSavingCount = 0;
for(DocumentController* candidate in SortedControllers())
{
if(folder == to_s(candidate.projectPath))
if(folder == to_s(candidate.projectPath ?: candidate.defaultProjectPath))
return bring_to_front(candidate);
}