{"id":41328,"date":"2023-12-06T14:06:32","date_gmt":"2023-12-06T19:06:32","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=41328"},"modified":"2023-12-06T14:06:32","modified_gmt":"2023-12-06T19:06:32","slug":"nsfilemanagers-file-copy-error-messages-lie","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2023\/12\/06\/nsfilemanagers-file-copy-error-messages-lie\/","title":{"rendered":"NSFileManager&rsquo;s File Copy Error Messages Lie"},"content":{"rendered":"<p><a href=\"https:\/\/lapcatsoftware.com\/articles\/2023\/11\/6.html\">Jeff Johnson<\/a>:<\/p>\n<blockquote cite=\"https:\/\/lapcatsoftware.com\/articles\/2023\/11\/6.html\"><p>The error says that the source file <code>InstallHistory.plist<\/code> doesn&rsquo;t exist, but the file does exist! The true reason for the copy failure is that the destination directory <code>\/Users\/Shared\/nonexistent\/<\/code> doesn&rsquo;t exist. Sigh.<\/p><p>I tested my command-line tool all the way back to macOS 10.13 High Sierra, and the behavior is the same! This is an <em>old<\/em> bug in <code>NSFileManager<\/code>. And note that the bug is not restricted to path-based API: it also affects <code>NSFileManager<\/code> URL-based API.<\/p><\/blockquote>\n<p>This is a really old bug, and it affects other types of failures, not just <code>NSFileNoSuchFileError<\/code>. I first encountered it when working on the SpamSieve installer for Apple Mail. I would ask <code>NSBundle<\/code> for the copy of the plug-in that was built into the app and then try to copy it to a protected folder, but the error message would say that it didn&rsquo;t have permission to read the source path that was in the app itself.<\/p>","protected":false},"excerpt":{"rendered":"<p>Jeff Johnson: The error says that the source file InstallHistory.plist doesn&rsquo;t exist, but the file does exist! The true reason for the copy failure is that the destination directory \/Users\/Shared\/nonexistent\/ doesn&rsquo;t exist. Sigh.I tested my command-line tool all the way back to macOS 10.13 High Sierra, and the behavior is the same! This is an [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2023-12-06T19:06:35Z","apple_news_api_id":"5f9626cc-3c1f-467d-81dd-af06e997e766","apple_news_api_modified_at":"2023-12-06T19:06:35Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/AX5YmzDwfRn2B3a8G6ZfnZg","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[69,30,1529,2385,71,372],"class_list":["post-41328","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-cocoa","tag-mac","tag-macos-10-13","tag-macos-14-sonoma","tag-programming","tag-spamsieve"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/41328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=41328"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/41328\/revisions"}],"predecessor-version":[{"id":41329,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/41328\/revisions\/41329"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=41328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=41328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=41328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}