I'm using Xcode 6.2 and Swift 1.1. 1. The following statement reports the error "'NSURL?' does not have a member named 'path'" even though executableURL has a trailing exclamation point to unwrap it. The caret identifying the location of the error is placed under the exclamation point.
for thisApp in NSWorkspace.sharedWorkspace().runningApplications { let thisPath = thisApp.executableURL!.path // ERROR } If I change executableURL to bundleURL, the error goes away. Yet executableURL and bundleURL are declared identically according to the NSRunningApplication reference document. As far as I know, bundleURL and executableURL both satisfy fileURL. The error also goes away if I assign thisApp to a local variable and expressly downcast it to NSRunningApplication, as shown below. Why would I need to do that with executableURL, when it isn't necessary with bundleURL? for thisApp in NSWorkspace.sharedWorkspace().runningApplications { let myAppAndIMeanIt = thisApp as NSRunningApplication let thisPath = myAppAndIMeanIt.executableURL!.path // NO ERROR } Is this a Swift bug? 2. Is executableURL suitable to get the URL to a flat-file (non-bundled) application? Or is it only intended to get the executable inside of an application bundle? I have always assumed the former, because NSRunningApplication handles LSUIElement and LSBackgroundOnly applications as well as ordinary foreground applications, but the reference document doesn't say and I can't find any discussion. 3. Are there any flat-file (non-bundled) applications out there any longer? I think I've noticed some in the System folder. -- Bill Cheeseman - b...@cheeseman.name _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com