From 6e326f3cea9329397b99e9b18af824c2d72a98fa Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 16 Jan 2021 18:27:41 -0800 Subject: [PATCH] Integrate trying to preserve Finder tags in 2.x https://github.com/sparkle-project/Sparkle/commit/1081dcdda187a9be5635594d388090f78de940f9 --- Autoupdate/SUPlainInstaller.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Autoupdate/SUPlainInstaller.m b/Autoupdate/SUPlainInstaller.m index b0821a55..05fc1940 100644 --- a/Autoupdate/SUPlainInstaller.m +++ b/Autoupdate/SUPlainInstaller.m @@ -133,6 +133,14 @@ return NO; } + // Try to preserve Finder Tags + // TODO: If we ever migrate to -[NSFileManager replaceItemAtURL:..] method, which we should at some point, we wouldn't have to do this step + NSArray *resourceTags = nil; + BOOL retrievedResourceTags = [oldURL getResourceValue:&resourceTags forKey:NSURLTagNamesKey error:NULL]; + if (retrievedResourceTags && resourceTags.count > 0) { + [newTempURL setResourceValue:resourceTags forKey:NSURLTagNamesKey error:NULL]; + } + // We must leave moving the app to its destination as the final step in installing it, so that // it's not possible our new app can be left in an incomplete state at the final destination if (![fileManager changeOwnerAndGroupOfItemAtRootURL:newTempURL toMatchURL:oldURL error:error]) {