shell/macOS: Make sure the root folder's cache is cleared on disconnect
authorJocelyn Turcotte <jturcotte@woboq.com>
Wed, 11 Jan 2017 17:17:27 +0000 (18:17 +0100)
committerJocelyn Turcotte <jturcotte@woboq.com>
Wed, 18 Jan 2017 11:15:52 +0000 (12:15 +0100)
The SocketAPI now only sends status pushes for paths requested by the
shell. We have to make sure that Finder doesn't just show the entry
from its cache after a reconnect.

shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/FinderSync.m

index a86f9485bedfb61292b3930239d7a6cfd4cbf6f6..065be2e2f5e707dc9f0d05f47476e9160133e56a 100644 (file)
 {
        _shareMenuTitle = nil;
        
+       [_registeredDirectories removeAllObjects];
+       // For some reason the FIFinderSync cache doesn't seem to be cleared for the root item when
+       // we reset the directoryURLs (seen on macOS 10.12 at least).
+       // First setting it to the FS root and then setting it to nil seems to work around the issue.
+       [FIFinderSyncController defaultController].directoryURLs = [NSSet setWithObject:[NSURL fileURLWithPath:@"/"]];
        // This will tell Finder that this extension isn't attached to any directory
        // until we can reconnect to the sync client.
-       [_registeredDirectories removeAllObjects];
        [FIFinderSyncController defaultController].directoryURLs = nil;
 }