![]() |
<< Index >> |
FutureBasic 5 |
Appendix A - File Object Specifiers | appendix | |
|
include "Tlbx LSOpen.incl"
include "Tlbx CFBundle.incl"
include resources "ReadMe.txt" // file to be copied to <app>/Contents/Resources
local mode
local fn OpenReadMe( name as CFStringRef )
dim as CFBundleRef bundle
dim as CFURLRef url
bundle = fn CFBundleGetMainBundle()
if ( bundle )
url = fn CFBundleCopyResourceURL( bundle, name, 0, 0 )
if ( url )
fn LSOpenCFURLRef( url, NULL )
CFRelease( url )
end if
end if
end fn
fn OpenReadMe( @"ReadMe.txt" )
do
HandleEvents
until gFBQuit
dim as FSRef fref
dim as Str255 fStr
fStr = files$( _FSRefOpen, "TEXT", "Open text file", fref )
long if ( fStr[0] )
// Do something with your text file FSRef
xelse
// User canceled
end if
begin record FSSpec
dim as short vRefNum
dim as long parID
dim as Str63 name
end record
dim as FSSpec fs
dim fs as FSSpec
fileName$ = fs.name
parentID = fs.parID
volRefNum = fs.vRefNum