[futurebasic] Re: [FB] Running app from Download folder

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 2017 : Group Archive : Group : All Groups

From: Ken Shmidheiser <kshmidheiser@...>
Date: Fri, 10 Mar 2017 19:13:25 -0500

I written a little program to test an application's permissions in the quest to understand the behavior you've discovered.

I'd be interested to see what differences there may be, if any, between your app's permissions while it's in the Downloads folder versus when it's on the Desktop. I'm particularly interested to see if NSFileExtensionHidden returns a quarantine message while in Downloads versus Desktop, and also if there is a difference between the three-character NSFilePosixPermissions dependent on the file location.


output file "App Attributes"

include "NSLog.incl"
include "Tlbx UTCoreTypes.incl"

local fn BuildMenus
apple menu @"Application File Attributes"
menu 1, 0, _enable, @"File"
menu 1, 1, _enable, @"Choose app to read attributes.../O"
edit menu 2
end fn

local fn FileAttributes ( fileURL as CFURLRef )
NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];
NSString *path = [(NSURL *)fileURL path];
NSDictionary *fileAttributes = [fileManager attributesOfItemAtPath: path error: NULL];

if (fileAttributes != nil)
    NSLog( @"File attributes:\n%@.", fileAttributes);
    NSLog(@"Path (%@) is invalid.", path);
end fn

local fn MyGetFileHandler( reply as ^NavReplyRecord, userData as pointer )
dim as CFURLRef  urlRef

NavDialog_CopyItemCFURLRef( #reply, 1, @urlRef )
fn FileAttributes ( urlRef )
end fn

local fn MyNavFilter( theItem as ^AEDesc, info as ^NavFileOrFolderInfo, callbackUD as pointer, filterMode as NavFilterModes ) as Boolean
dim as Boolean   display : display = _false

if ( info.isFolder ) then display = _true : exit fn // always allow going into folders
if ( fn NavDialog_UTIConformsTo( #theItem, kUTTypeApplication ) ) then display = _true
end fn = display

local fn UserSelectApplication
NavDialog_SetFilterFn( @fn MyNavFilter )
fn NavDialog( _kNavDialogChooseObject + _kNavDialogSupportPackages, "Choose app to read attributes...", "", @fn MyGetFileHandler, NULL )
end fn

local fn DoMenu
dim as long menuID, itemID

menuID = menu( _menuID )
itemID = menu( _itemID )

select ( menuID )
case 1
select (itemID)
case 1 : fn UserSelectApplication
end select
end select
end fn

on menu fn DoMenu
fn BuildMenus
fn UserSelectApplication

until gFBQuit