Unexpected changed of displayName and how to change it?

Hi,

I'm developing Replicated File Provider extension on macOS. Recently I notice sometimes, the displayName of domain got changed or became empty on finder sidebar.

It seems related to how I construct a NSFileProviderManager object. If I use an NSFileProviderDomain object with empty displayName value, at some wired point, finder will get massed up.

let id = NSFileProviderDomainIdentifier(rawValue: "my-domain-1")
let domain = NSFileProviderDomain(identifier: id, displayName: "")
guard let manager = NSFileProviderManager(for: domain) else {
  return
}
....

Can any internal staff help to check whether constructing a NSFileProviderManager with inefficient NSFileProviderDomain object might affect finder?

This issue cause me to think another problem, how can I change the displayName of a domain? It would be nice let user decide and configure a nice name for it.

Thanks.

Jack

The displayName property is used when displaying the domain in the Finder sidebar under Locations. You should set that to a human readable string, so the user can see something meaningful in Finder.

Whenever you call -[NSFileProviderManager addDomain:completionHandler:], the system will take your NSFileProviderDomain object and apply it to the system. If you call addDomain multiple times with the same NSFileProviderDomainIdentifier, the system will take the latest object you passed and apply it.

Therefore, if you called addDomain with an empty display name, the system will apply that.

Be sure to construct the NSFileProviderDomain with all relevant properties set, every time that you call addDomain.

Hi @clenart ,

Thanks for the replay!

I know that addDomain needs a valid displayName, but my problem is a little different.

While I create NSFileProviderManager object (using above snippet code), sometimes it'll change displayname of a already added domain.

I found more detail log today. It seems that fileproviderd detect displayname changed and did change the domain info and physical directory path.

2022-11-30 17:29:14.657796+0800 0x6c5f     Default     0x0                  1332   0    fileproviderd: (FileProviderDaemon) [com.apple.FileProvider:default] [NOTICE] need a new domain for <private> because display name changed

Can you help to reach developer team and check whether this is an bug?

Thanks.


more log here

2022-11-30 17:29:14.657427+0800 0x6c15     Debug       0x0                  1332   0    fileproviderd: (FileProviderDaemon) [com.apple.FileProvider:default] [DEBUG] Adding domain <private> at URL (null) with persona unique string:'(null)', perso:0 ent:0 def:0 sys:0 type:1000
2022-11-30 17:29:14.657530+0800 0x6c15     Debug       0x0                  1332   0    fileproviderd: (FileProvider) [com.apple.FileProvider:default] [DEBUG] ┣1a1 dispatching to <private>
2022-11-30 17:29:14.657570+0800 0x6c15     Debug       0x0                  1332   0    fileproviderd: (FileProvider) [com.apple.FileProvider:default] [DEBUG] ┗19e
2022-11-30 17:29:14.657584+0800 0x6c5f     Debug       0x0                  1332   0    fileproviderd: (FileProvider) [com.apple.FileProvider:default] [DEBUG] ┳1a1 continuing on <private>
2022-11-30 17:29:14.657656+0800 0x6c5f     Default     0x0                  1332   0    fileproviderd: (FileProviderDaemon) [com.apple.FileProvider:default] [NOTICE] Adding domain <private> for extension <private>, importing directory (null), for pid=594 name=... path=.... isPOSIX=0
2022-11-30 17:29:14.657697+0800 0x6c5f     Debug       0x0                  1332   0    fileproviderd: (FileProviderDaemon) [com.apple.FileProvider:default] [DEBUG] creating domain as userEnabled because the provider already has one enabled domain: <private>
2022-11-30 17:29:14.657717+0800 0x6c15     Debug       0x0                  1332   0    fileproviderd: (FileProviderDaemon) [com.apple.FileProvider:default] [DEBUG] invalidating <private>
2022-11-30 17:29:14.657731+0800 0x6c5f     Debug       0x0                  1332   0    fileproviderd: (FileProviderDaemon) [com.apple.FileProvider:default] [DEBUG] domain <private> already exists
2022-11-30 17:29:14.657786+0800 0x6c67     Debug       0x0                  1332   0    fileproviderd: (FileProviderDaemon) [com.apple.FileProvider:default] [DEBUG] Invalidating <private> because we don't have any inflight request or lifetime extender #lifetime
2022-11-30 17:29:14.657796+0800 0x6c5f     Default     0x0                  1332   0    fileproviderd: (FileProviderDaemon) [com.apple.FileProvider:default] [NOTICE] need a new domain for <private> because display name changed
2022-11-30 17:29:14.657869+0800 0x6c67     Debug       0x0                  1332   0    fileproviderd: (CloudDocs) [com.apple.clouddocs:default personal] [DEBUG] notifying '<private>' on token 30 with state 0
2022-11-30 17:29:14.657883+0800 0x6c5f     Default     0x0                  1332   0    fileproviderd: (FileProviderDaemon) [com.apple.FileProvider:default] [NOTICE] domain <FPDDomain: 0x7fde418155f0> ..., user-enabled is being disconnected, switching to a dead-end backend

This forum will eat me comment... so I use replay here.

I'm not sure which code I need to provide here, there are a lot of them, but I did use disconnect before program exit and reconnect after program start!

This problem did happen frequently when program exit and/or start.

Maybe this can provide some insight.

thanks :)

Unexpected changed of displayName and how to change it?
 
 
Q