Folders.pas 78 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779
  1. {
  2. File: CarbonCore/Folders.h
  3. Contains: Folder Manager Interfaces.
  4. The contents of this header file are deprecated.
  5. Use NSFileManager instead.
  6. Copyright: © 1995-2011 by Apple Inc. All rights reserved.
  7. }
  8. { Pascal Translation Updated: Gale R Paeper, <[email protected]>, June 2018 }
  9. {
  10. Modified for use with Free Pascal
  11. Version 308
  12. Please report any bugs to <[email protected]>
  13. }
  14. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  15. {$mode macpas}
  16. {$modeswitch cblocks}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$calling mwpascal}
  21. unit Folders;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  24. {$setc GAP_INTERFACES_VERSION := $0308}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  40. {$setc __ppc64__ := 1}
  41. {$elsec}
  42. {$setc __ppc64__ := 0}
  43. {$endc}
  44. {$ifc not defined __i386__ and defined CPUI386}
  45. {$setc __i386__ := 1}
  46. {$elsec}
  47. {$setc __i386__ := 0}
  48. {$endc}
  49. {$ifc not defined __x86_64__ and defined CPUX86_64}
  50. {$setc __x86_64__ := 1}
  51. {$elsec}
  52. {$setc __x86_64__ := 0}
  53. {$endc}
  54. {$ifc not defined __arm__ and defined CPUARM}
  55. {$setc __arm__ := 1}
  56. {$elsec}
  57. {$setc __arm__ := 0}
  58. {$endc}
  59. {$ifc not defined __arm64__ and defined CPUAARCH64}
  60. {$setc __arm64__ := 1}
  61. {$elsec}
  62. {$setc __arm64__ := 0}
  63. {$endc}
  64. {$ifc defined cpu64}
  65. {$setc __LP64__ := 1}
  66. {$elsec}
  67. {$setc __LP64__ := 0}
  68. {$endc}
  69. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  70. {$error Conflicting definitions for __ppc__ and __i386__}
  71. {$endc}
  72. {$ifc defined __ppc__ and __ppc__}
  73. {$setc TARGET_CPU_PPC := TRUE}
  74. {$setc TARGET_CPU_PPC64 := FALSE}
  75. {$setc TARGET_CPU_X86 := FALSE}
  76. {$setc TARGET_CPU_X86_64 := FALSE}
  77. {$setc TARGET_CPU_ARM := FALSE}
  78. {$setc TARGET_CPU_ARM64 := FALSE}
  79. {$setc TARGET_OS_MAC := TRUE}
  80. {$setc TARGET_OS_IPHONE := FALSE}
  81. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  82. {$setc TARGET_OS_EMBEDDED := FALSE}
  83. {$elifc defined __ppc64__ and __ppc64__}
  84. {$setc TARGET_CPU_PPC := FALSE}
  85. {$setc TARGET_CPU_PPC64 := TRUE}
  86. {$setc TARGET_CPU_X86 := FALSE}
  87. {$setc TARGET_CPU_X86_64 := FALSE}
  88. {$setc TARGET_CPU_ARM := FALSE}
  89. {$setc TARGET_CPU_ARM64 := FALSE}
  90. {$setc TARGET_OS_MAC := TRUE}
  91. {$setc TARGET_OS_IPHONE := FALSE}
  92. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  93. {$setc TARGET_OS_EMBEDDED := FALSE}
  94. {$elifc defined __i386__ and __i386__}
  95. {$setc TARGET_CPU_PPC := FALSE}
  96. {$setc TARGET_CPU_PPC64 := FALSE}
  97. {$setc TARGET_CPU_X86 := TRUE}
  98. {$setc TARGET_CPU_X86_64 := FALSE}
  99. {$setc TARGET_CPU_ARM := FALSE}
  100. {$setc TARGET_CPU_ARM64 := FALSE}
  101. {$ifc defined iphonesim}
  102. {$setc TARGET_OS_MAC := FALSE}
  103. {$setc TARGET_OS_IPHONE := TRUE}
  104. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  105. {$elsec}
  106. {$setc TARGET_OS_MAC := TRUE}
  107. {$setc TARGET_OS_IPHONE := FALSE}
  108. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  109. {$endc}
  110. {$setc TARGET_OS_EMBEDDED := FALSE}
  111. {$elifc defined __x86_64__ and __x86_64__}
  112. {$setc TARGET_CPU_PPC := FALSE}
  113. {$setc TARGET_CPU_PPC64 := FALSE}
  114. {$setc TARGET_CPU_X86 := FALSE}
  115. {$setc TARGET_CPU_X86_64 := TRUE}
  116. {$setc TARGET_CPU_ARM := FALSE}
  117. {$setc TARGET_CPU_ARM64 := FALSE}
  118. {$ifc defined iphonesim}
  119. {$setc TARGET_OS_MAC := FALSE}
  120. {$setc TARGET_OS_IPHONE := TRUE}
  121. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  122. {$elsec}
  123. {$setc TARGET_OS_MAC := TRUE}
  124. {$setc TARGET_OS_IPHONE := FALSE}
  125. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  126. {$endc}
  127. {$setc TARGET_OS_EMBEDDED := FALSE}
  128. {$elifc defined __arm__ and __arm__}
  129. {$setc TARGET_CPU_PPC := FALSE}
  130. {$setc TARGET_CPU_PPC64 := FALSE}
  131. {$setc TARGET_CPU_X86 := FALSE}
  132. {$setc TARGET_CPU_X86_64 := FALSE}
  133. {$setc TARGET_CPU_ARM := TRUE}
  134. {$setc TARGET_CPU_ARM64 := FALSE}
  135. {$setc TARGET_OS_MAC := FALSE}
  136. {$setc TARGET_OS_IPHONE := TRUE}
  137. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  138. {$setc TARGET_OS_EMBEDDED := TRUE}
  139. {$elifc defined __arm64__ and __arm64__}
  140. {$setc TARGET_CPU_PPC := FALSE}
  141. {$setc TARGET_CPU_PPC64 := FALSE}
  142. {$setc TARGET_CPU_X86 := FALSE}
  143. {$setc TARGET_CPU_X86_64 := FALSE}
  144. {$setc TARGET_CPU_ARM := FALSE}
  145. {$setc TARGET_CPU_ARM64 := TRUE}
  146. {$ifc defined ios}
  147. {$setc TARGET_OS_MAC := FALSE}
  148. {$setc TARGET_OS_IPHONE := TRUE}
  149. {$setc TARGET_OS_EMBEDDED := TRUE}
  150. {$elsec}
  151. {$setc TARGET_OS_MAC := TRUE}
  152. {$setc TARGET_OS_IPHONE := FALSE}
  153. {$setc TARGET_OS_EMBEDDED := FALSE}
  154. {$endc}
  155. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  156. {$elsec}
  157. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  158. {$endc}
  159. {$ifc defined __LP64__ and __LP64__ }
  160. {$setc TARGET_CPU_64 := TRUE}
  161. {$elsec}
  162. {$setc TARGET_CPU_64 := FALSE}
  163. {$endc}
  164. {$ifc defined FPC_BIG_ENDIAN}
  165. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  166. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  167. {$elifc defined FPC_LITTLE_ENDIAN}
  168. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  169. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  170. {$elsec}
  171. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  172. {$endc}
  173. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  174. {$setc CALL_NOT_IN_CARBON := FALSE}
  175. {$setc OLDROUTINENAMES := FALSE}
  176. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  177. {$setc OPAQUE_UPP_TYPES := TRUE}
  178. {$setc OTCARBONAPPLICATION := TRUE}
  179. {$setc OTKERNEL := FALSE}
  180. {$setc PM_USE_SESSION_APIS := TRUE}
  181. {$setc TARGET_API_MAC_CARBON := TRUE}
  182. {$setc TARGET_API_MAC_OS8 := FALSE}
  183. {$setc TARGET_API_MAC_OSX := TRUE}
  184. {$setc TARGET_CARBON := TRUE}
  185. {$setc TARGET_CPU_68K := FALSE}
  186. {$setc TARGET_CPU_MIPS := FALSE}
  187. {$setc TARGET_CPU_SPARC := FALSE}
  188. {$setc TARGET_OS_UNIX := FALSE}
  189. {$setc TARGET_OS_WIN32 := FALSE}
  190. {$setc TARGET_RT_MAC_68881 := FALSE}
  191. {$setc TARGET_RT_MAC_CFM := FALSE}
  192. {$setc TARGET_RT_MAC_MACHO := TRUE}
  193. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  194. {$setc TYPE_BOOL := FALSE}
  195. {$setc TYPE_EXTENDED := FALSE}
  196. {$setc TYPE_LONGLONG := TRUE}
  197. uses MacTypes,Files;
  198. {$endc} {not MACOSALLINCLUDE}
  199. {$ifc TARGET_OS_MAC}
  200. {$ALIGN MAC68K}
  201. {
  202. Common folder locations:
  203. ========================
  204. kSystemDomain is generally /System and things inside it, so
  205. - kSystemDomain, kDomainLibraryFolderType is /System/Library/
  206. - kSystemDomain, kTrashFolderType is a trash folder on the same volume as /System ( the boot disk )
  207. - kSystemDomain, kDomainTopLevelFolderType is the root of the system domain, so it's the same as /System
  208. kLocalDomain is generally the admin-writeable, system-wide location for things, so
  209. - kLocalDomain, kDomainLibraryFolderType is /Library/
  210. kUserDomain maps to the current user's home folder, so that
  211. - kUserDomain, kCurrentUserFolderType is the user's home folder itself ( "$HOME", ~ )
  212. - kUserDomain, kDomainLibraryFolderType is the Library folder in the user home ( "$HOME/Library", "~/Library/" )
  213. - kUserDomain, kPreferencesFolderType is the Preferences folder in the user home ( "$HOME/Library/Preferences/" )
  214. - kUserDomain, kTrashFolderType is a trash folder on the same volume as the user home
  215. kNetworkDomain, if configured, is a network file system which a network administrator may have installed items into
  216. - kNetworkDomain, kApplicationsFolderType is /Network/Applications/
  217. kClassicDomain, if configured, is where the Mac OS X Classic environment information is stored
  218. - kClassicDomain, kSystemFolderType is the currently active Macintosh Classic system folder ( or fnfErr if a Classic isn't installed )
  219. }
  220. const
  221. kOnSystemDisk = -32768; { previously was 0x8000 but that is an unsigned value whereas vRefNum is signed}
  222. kOnAppropriateDisk = -32767; { Generally, the same as kOnSystemDisk, but it's clearer that this isn't always the 'boot' disk.}
  223. { Folder Domains - Carbon only. The constants above can continue to be used, but the folder/volume returned will}
  224. { be from one of the domains below.}
  225. kSystemDomain = -32766; { Read-only system hierarchy.}
  226. kLocalDomain = -32765; { All users of a single machine have access to these resources.}
  227. kNetworkDomain = -32764; { All users configured to use a common network server has access to these resources.}
  228. kUserDomain = -32763; { Read/write. Resources that are private to the user.}
  229. kClassicDomain = -32762; { Domain referring to the currently configured Classic System Folder. Not supported in Mac OS X Leopard and later.}
  230. kFolderManagerLastDomain = -32760;
  231. {
  232. The ID of the last domain in the above list, used by the Folder Manager to determine if a given
  233. parameter should be treated as a domain or a volume...
  234. }
  235. const
  236. kLastDomainConstant = -32760;
  237. const
  238. kCreateFolder = true;
  239. kDontCreateFolder = false;
  240. {
  241. * FindFolder()
  242. *
  243. * Summary:
  244. * Obtains location information for system-related directories.
  245. *
  246. * Discussion:
  247. * For the folder type on the particular volume (specified,
  248. * respectively, in the folderType and vRefNum parameters), the
  249. * FindFolder function returns the directory's volume reference
  250. * number in the foundVRefNum parameter and its directory ID in the
  251. * foundDirID parameter.
  252. *
  253. * The specified folder used for a given volume might be located on
  254. * a different volume in future versions of system software;
  255. * therefore, do not assume the volume that you specify in vRefNum
  256. * and the volume returned in foundVRefNum will be the same.
  257. *
  258. * Specify a volume reference number (or the constant kOnSystemDisk
  259. * for the startup disk) or one of the domain constants ( on Mac OS
  260. * X ) in the vRefNum parameter.
  261. *
  262. * Specify a four-character folder type--or the constant that
  263. * represents it--in the folderType parameter.
  264. *
  265. * Use the constant kCreateFolder in the createFolder parameter to
  266. * tell FindFolder to create a directory if it does not already
  267. * exist; otherwise, use the constant kDontCreateFolder. Directories
  268. * inside the System Folder are created only if the System Folder
  269. * directory exists. The FindFolder function will not create a
  270. * System Folder directory even if you specify the kCreateFolder
  271. * constant in the createFolder parameter.
  272. *
  273. * The FindFolder function returns a nonzero result code if the
  274. * folder isn't found, and it can also return other file system
  275. * errors reported by the File Manager or Memory Manager.
  276. *
  277. * Mac OS X threading:
  278. * Thread safe since version 10.3
  279. *
  280. * Parameters:
  281. *
  282. * vRefNum:
  283. * Pass the volume reference number of the volume on which you
  284. * want to locate a directory, or a constant specifying a disk or
  285. * domain. The constants which you can use in this parameter are
  286. * described in "Disk and Domain Constants".
  287. * Note that, on Mac OS X, passing a volume reference number in
  288. * this parameter does not make sense for most of the folder type
  289. * selectors which you can specify in the folderType parameter. On
  290. * Mac OS X, folders are "domain-oriented"; because there may be
  291. * more than one domain on any given physical volume, asking for
  292. * these folders on a per-volume basis yields undefined results.
  293. * For example, if you were to request the Fonts folder
  294. * (represented by the selector kFontsFolderType ) on volume -100,
  295. * are you requesting the folder /System/Library/Fonts,
  296. * /Library/Fonts, or ~/Fonts? On Mac OS X you should pass a disk
  297. * or domain constant in this parameter.
  298. *
  299. * folderType:
  300. * A four-character folder type, or a constant that represents the
  301. * type, for the directory you want to find.
  302. *
  303. * createFolder:
  304. * Pass the constant kCreateFolder in this parameter to create a
  305. * directory if it does not already exist; otherwise, pass the
  306. * constant kDontCreateFolder.
  307. *
  308. * foundVRefNum:
  309. * The volume reference number, returned by FindFolder , for the
  310. * volume containing the directory you specify in the folderType
  311. * parameter.
  312. *
  313. * foundDirID:
  314. * The directory ID number, returned by FindFolder , for the
  315. * directory you specify in the folderType parameter.
  316. *
  317. * Availability:
  318. * Mac OS X: in version 10.0 and later in CoreServices.framework
  319. * CarbonLib: in CarbonLib 1.0 and later
  320. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  321. }
  322. function FindFolder( vRefNum: FSVolumeRefNum; folderType: OSType; createFolder: Boolean; var foundVRefNum: FSVolumeRefNum; var foundDirID: SInt32 ): OSErr; external name '_FindFolder';
  323. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  324. {
  325. * ReleaseFolder() *** DEPRECATED ***
  326. *
  327. * Deprecated:
  328. * This call is not needed on Mac OS X and later.
  329. *
  330. * Summary:
  331. * On Mac OS 9.x and earlier, release any hold the system may have
  332. * on a given folder on a volume so that the volume may be unmounted.
  333. *
  334. * Discussion:
  335. * On Mac OS 9.x, the system sometimes has files open on volumes
  336. * which need to be closed in order for the volume to be
  337. * successfully unmounted. This call releases any hold the Folder
  338. * Manager may have for the given volume.
  339. * <br> This call is unnecessary on Mac OS X and later.
  340. *
  341. * Mac OS X threading:
  342. * Thread safe since version 10.3
  343. *
  344. * Parameters:
  345. *
  346. * vRefNum:
  347. * The vRefNum to release.
  348. *
  349. * folderType:
  350. * The folder type to release.
  351. *
  352. * Availability:
  353. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.3
  354. * CarbonLib: in CarbonLib 1.0 and later
  355. * Non-Carbon CFM: in FoldersLib 1.0 and later
  356. }
  357. function ReleaseFolder( vRefNum: FSVolumeRefNum; folderType: OSType ): OSErr; external name '_ReleaseFolder';
  358. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
  359. {
  360. * FSFindFolder()
  361. *
  362. * Summary:
  363. * FSFindFolder returns an FSRef for certain system-related
  364. * directories.
  365. *
  366. * Discussion:
  367. * For the folder type on the particular volume (specified,
  368. * respectively, in the folderType and vRefNum parameters), the
  369. * FindFolder function returns the FSRef of that directory.
  370. *
  371. * The specified folder used for a given volume might be located on
  372. * a different volume in future versions of system software;
  373. * therefore, do not assume the volume that you specify in vRefNum
  374. * and the volume returned in the FSRef will be the same.
  375. *
  376. * Specify a volume reference number (or the constant kOnSystemDisk
  377. * for the startup disk) or one of the domain constants ( on Mac OS
  378. * X ) in the vRefNum parameter.
  379. *
  380. * Specify a four-character folder type--or the constant that
  381. * represents it--in the folderType parameter.
  382. *
  383. * Use the constant kCreateFolder in the createFolder parameter to
  384. * tell FindFolder to create a directory if it does not already
  385. * exist; otherwise, use the constant kDontCreateFolder. Directories
  386. * inside the System Folder are created only if the System Folder
  387. * directory exists. The FindFolder function will not create a
  388. * System Folder directory even if you specify the kCreateFolder
  389. * constant in the createFolder parameter.
  390. *
  391. * The FindFolder function returns a nonzero result code if the
  392. * folder isn't found, and it can also return other file system
  393. * errors reported by the File Manager or Memory Manager.
  394. *
  395. * Mac OS X threading:
  396. * Thread safe since version 10.3
  397. *
  398. * Parameters:
  399. *
  400. * vRefNum:
  401. * The volume reference number (or the constant kOnSystemDisk for
  402. * the startup disk) or one of the domain constants ( like
  403. * kUserDomain ) of the volume or domain in which you want to
  404. * locate a directory.
  405. *
  406. * folderType:
  407. * A four-character folder type, or a constant that represents the
  408. * type, for the directory you want to find.
  409. *
  410. * createFolder:
  411. * Pass the constant kCreateFolder in this parameter to create a
  412. * directory if it does not already exist; otherwise, pass the
  413. * constant kDontCreateFolder.
  414. *
  415. * foundRef:
  416. * The FSRef for the directory you specify on the volume or domain
  417. * and folderType given.
  418. *
  419. * Availability:
  420. * Mac OS X: in version 10.0 and later in CoreServices.framework
  421. * CarbonLib: in CarbonLib 1.1 and later
  422. * Non-Carbon CFM: in InterfaceLib 9.1 and later
  423. }
  424. function FSFindFolder( vRefNum: FSVolumeRefNum; folderType: OSType; createFolder: Boolean; var foundRef: FSRef ): OSErr; external name '_FSFindFolder';
  425. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  426. {//}
  427. {
  428. * Folder types
  429. *
  430. }
  431. const
  432. kDesktopFolderType = FourCharCode('desk'); { the desktop folder; objects in this folder show on the desktop. }
  433. kTrashFolderType = FourCharCode('trsh'); { the trash folder; objects in this folder show up in the trash }
  434. kWhereToEmptyTrashFolderType = FourCharCode('empt'); { the "empty trash" folder; Finder starts empty from here down }
  435. kFontsFolderType = FourCharCode('font'); { Fonts go here }
  436. kPreferencesFolderType = FourCharCode('pref'); { preferences for applications go here }
  437. kSystemPreferencesFolderType = FourCharCode('sprf'); { the PreferencePanes folder, where Mac OS X Preference Panes go }
  438. kTemporaryFolderType = FourCharCode('temp'); { On Mac OS X, each user has their own temporary items folder, and the Folder Manager attempts to set permissions of these}
  439. { folders such that other users can not access the data inside. On Mac OS X 10.4 and later the data inside the temporary}
  440. { items folder is deleted at logout and at boot, but not otherwise. Earlier version of Mac OS X would delete items inside}
  441. { the temporary items folder after a period of inaccess. You can ask for a temporary item in a specific domain or on a }
  442. { particular volume by FSVolumeRefNum. If you want a location for temporary items for a short time, then use either}
  443. { ( kUserDomain, kkTemporaryFolderType ) or ( kSystemDomain, kTemporaryFolderType ). The kUserDomain varient will always be}
  444. { on the same volume as the user's home folder, while the kSystemDomain version will be on the same volume as /var/tmp/ ( and}
  445. { will probably be on the local hard drive in case the user's home is a network volume ). If you want a location for a temporary}
  446. { file or folder to use for saving a document, especially if you want to use FSpExchangeFile() to implement a safe-save, then}
  447. { ask for the temporary items folder on the same volume as the file you are safe saving.}
  448. { However, be prepared for a failure to find a temporary folder in any domain or on any volume. Some volumes may not have}
  449. { a location for a temporary folder, or the permissions of the volume may be such that the Folder Manager can not return}
  450. { a temporary folder for the volume.}
  451. { If your application creates an item in a temporary items older you should delete that item as soon as it is not needed,}
  452. { and certainly before your application exits, since otherwise the item is consuming disk space until the user logs out or}
  453. { restarts. Any items left inside a temporary items folder should be moved into a folder inside the Trash folder on the disk}
  454. { when the user logs in, inside a folder named "Recovered items", in case there is anything useful to the end user.}
  455. kChewableItemsFolderType = FourCharCode('flnt'); { similar to kTemporaryItemsFolderType, except items in this folder are deleted at boot or when the disk is unmounted }
  456. kTemporaryItemsInCacheDataFolderType = FourCharCode('vtmp'); { A folder inside the kCachedDataFolderType for the given domain which can be used for transient data}
  457. kApplicationsFolderType = FourCharCode('apps'); { Applications on Mac OS X are typically put in this folder ( or a subfolder ).}
  458. kVolumeRootFolderType = FourCharCode('root'); { root folder of a volume or domain }
  459. kDomainTopLevelFolderType = FourCharCode('dtop'); { The top-level of a Folder domain, e.g. "/System"}
  460. kDomainLibraryFolderType = FourCharCode('dlib'); { the Library subfolder of a particular domain}
  461. kUsersFolderType = FourCharCode('usrs'); { "Users" folder, usually contains one folder for each user. }
  462. kCurrentUserFolderType = FourCharCode('cusr'); { The folder for the currently logged on user; domain passed in is ignored. }
  463. kSharedUserDataFolderType = FourCharCode('sdat'); { A Shared folder, readable & writeable by all users }
  464. {
  465. The following selectors refer specifically to subfolders inside the user's home folder, and should
  466. be used only with kUserDomain as the domain in the various FindFolder calls.
  467. }
  468. const
  469. kDocumentsFolderType = FourCharCode('docs'); { User documents are typically put in this folder ( or a subfolder ).}
  470. kPictureDocumentsFolderType = FourCharCode('pdoc'); { Refers to the "Pictures" folder in a users home directory}
  471. kMovieDocumentsFolderType = FourCharCode('mdoc'); { Refers to the "Movies" folder in a users home directory}
  472. kMusicDocumentsFolderType = FourCharCode('µdoc'); { Refers to the "Music" folder in a users home directory}
  473. kInternetSitesFolderType = FourCharCode('site'); { Refers to the "Sites" folder in a users home directory}
  474. kPublicFolderType = FourCharCode('pubb'); { Refers to the "Public" folder in a users home directory}
  475. { The following selectors are available on Mac OS X 10.7 and later.}
  476. const
  477. kDropBoxFolderType = FourCharCode('drop'); { Refers to the "Drop Box" folder inside the user's home directory}
  478. const
  479. kSharedLibrariesFolderType = FourCharCode('Älib'); { for general shared libs. }
  480. kVoicesFolderType = FourCharCode('fvoc'); { macintalk can live here }
  481. kUtilitiesFolderType = FourCharCode('utiÄ'); { for Utilities folder }
  482. kThemesFolderType = FourCharCode('thme'); { for Theme data files }
  483. kFavoritesFolderType = FourCharCode('favs'); { Favorties folder for Navigation Services }
  484. kInternetSearchSitesFolderType = FourCharCode('issf'); { Internet Search Sites folder }
  485. kInstallerLogsFolderType = FourCharCode('ilgf'); { Installer Logs folder }
  486. kScriptsFolderType = FourCharCode('scrÄ'); { Scripts folder }
  487. kFolderActionsFolderType = FourCharCode('fasf'); { Folder Actions Scripts folder }
  488. kSpeakableItemsFolderType = FourCharCode('spki'); { Speakable Items folder }
  489. kKeychainFolderType = FourCharCode('kchn'); { Keychain folder }
  490. { New Folder Types to accommodate the Mac OS X Folder Manager }
  491. { These folder types are not applicable on Mac OS 9. }
  492. const
  493. kColorSyncFolderType = FourCharCode('sync'); { Contains ColorSync-related folders}
  494. kColorSyncCMMFolderType = FourCharCode('ccmm'); { ColorSync CMMs}
  495. kColorSyncScriptingFolderType = FourCharCode('cscr'); { ColorSync Scripting support}
  496. kPrintersFolderType = FourCharCode('impr'); { Contains Printing-related folders}
  497. kSpeechFolderType = FourCharCode('spch'); { Contains Speech-related folders}
  498. kCarbonLibraryFolderType = FourCharCode('carb'); { Contains Carbon-specific file}
  499. kDocumentationFolderType = FourCharCode('info'); { Contains Documentation files (not user documents)}
  500. kISSDownloadsFolderType = FourCharCode('issd'); { Contains Internet Search Sites downloaded from the Internet}
  501. kUserSpecificTmpFolderType = FourCharCode('utmp'); { Contains temporary items created on behalf of the current user}
  502. kCachedDataFolderType = FourCharCode('cach'); { Contains various cache files for different clients}
  503. kFrameworksFolderType = FourCharCode('fram'); { Contains MacOS X Framework folders}
  504. kPrivateFrameworksFolderType = FourCharCode('pfrm'); { Contains MacOS X Private Framework folders }
  505. kClassicDesktopFolderType = FourCharCode('sdsk'); { MacOS 9 compatible desktop folder - same as kSystemDesktopFolderType but with a more appropriate name for Mac OS X code.}
  506. kSystemSoundsFolderType = FourCharCode('ssnd'); { Contains Mac OS X System Sound Files ( valid in kSystemDomain, kLocalDomain, and kUserDomain )}
  507. kComponentsFolderType = FourCharCode('cmpd'); { Contains Mac OS X components ( valid in kSystemDomain, kLocalDomain, and kUserDomain )}
  508. kQuickTimeComponentsFolderType = FourCharCode('wcmp'); { Contains QuickTime components for Mac OS X ( valid in kSystemDomain, kLocalDomain, and kUserDomain )}
  509. kCoreServicesFolderType = FourCharCode('csrv'); { Refers to the "/System/Library/CoreServices" folder on Mac OS X}
  510. kAudioSupportFolderType = FourCharCode('adio'); { Refers to the Audio support folder for Mac OS X}
  511. kAudioPresetsFolderType = FourCharCode('apst'); { "Presets" folder of "Audio" folder, Mac OS X 10.4 and later}
  512. kAudioSoundsFolderType = FourCharCode('asnd'); { Refers to the Sounds subfolder of Audio Support}
  513. kAudioSoundBanksFolderType = FourCharCode('bank'); { Refers to the Banks subfolder of the Sounds Folder}
  514. kAudioAlertSoundsFolderType = FourCharCode('alrt'); { Refers to the Alert Sounds subfolder of the Sound Folder}
  515. kAudioPlugInsFolderType = FourCharCode('aplg'); { Refers to the Plug-ins subfolder of the Audio Folder }
  516. kAudioComponentsFolderType = FourCharCode('acmp'); { Refers to the Components subfolder of the Audio Plug-ins Folder }
  517. kKernelExtensionsFolderType = FourCharCode('kext'); { Refers to the Kernel Extensions Folder on Mac OS X}
  518. kDirectoryServicesFolderType = FourCharCode('dsrv'); { Refers to the Directory Services folder on Mac OS X}
  519. kDirectoryServicesPlugInsFolderType = FourCharCode('dplg'); { Refers to the Directory Services Plug-Ins folder on Mac OS X }
  520. kInstallerReceiptsFolderType = FourCharCode('rcpt'); { Refers to the "Receipts" folder in Mac OS X}
  521. kFileSystemSupportFolderType = FourCharCode('fsys'); { Refers to the [domain]/Library/Filesystems folder in Mac OS X}
  522. kAppleShareSupportFolderType = FourCharCode('shar'); { Refers to the [domain]/Library/Filesystems/AppleShare folder in Mac OS X}
  523. kAppleShareAuthenticationFolderType = FourCharCode('auth'); { Refers to the [domain]/Library/Filesystems/AppleShare/Authentication folder in Mac OS X}
  524. kMIDIDriversFolderType = FourCharCode('midi'); { Refers to the MIDI Drivers folder on Mac OS X}
  525. kKeyboardLayoutsFolderType = FourCharCode('klay'); { Refers to the [domain]/Library/KeyboardLayouts folder in Mac OS X}
  526. kIndexFilesFolderType = FourCharCode('indx'); { Refers to the [domain]/Library/Indexes folder in Mac OS X}
  527. kFindByContentIndexesFolderType = FourCharCode('fbcx'); { Refers to the [domain]/Library/Indexes/FindByContent folder in Mac OS X}
  528. kManagedItemsFolderType = FourCharCode('mang'); { Refers to the Managed Items folder for Mac OS X }
  529. kBootTimeStartupItemsFolderType = FourCharCode('empz'); { Refers to the "StartupItems" folder of Mac OS X }
  530. kAutomatorWorkflowsFolderType = FourCharCode('flow'); { Automator Workflows folder }
  531. kAutosaveInformationFolderType = FourCharCode('asav'); { ~/Library/Autosaved Information/ folder, can be used to store autosave information for user's applications. Available in Mac OS X 10.4 and later. }
  532. kSpotlightSavedSearchesFolderType = FourCharCode('spot'); { Usually ~/Library/Saved Searches/; used by Finder and Nav/Cocoa panels to find saved Spotlight searches }
  533. { The following folder types are available in Mac OS X 10.5 and later }
  534. kSpotlightImportersFolderType = FourCharCode('simp'); { Folder for Spotlight importers, usually /Library/Spotlight/ or ~/Library/Spotlight, etc. }
  535. kSpotlightMetadataCacheFolderType = FourCharCode('scch'); { Folder for Spotlight metadata caches, for example: ~/Library/Caches/Metadata/ }
  536. kInputManagersFolderType = FourCharCode('inpt'); { InputManagers }
  537. kInputMethodsFolderType = FourCharCode('inpf'); { ../Library/Input Methods/ }
  538. kLibraryAssistantsFolderType = FourCharCode('astl'); { Refers to the [domain]/Library/Assistants folder}
  539. kAudioDigidesignFolderType = FourCharCode('adig'); { Refers to the Digidesign subfolder of the Audio Plug-ins folder}
  540. kAudioVSTFolderType = FourCharCode('avst'); { Refers to the VST subfolder of the Audio Plug-ins folder}
  541. kColorPickersFolderType = FourCharCode('cpkr'); { Refers to the ColorPickers folder}
  542. kCompositionsFolderType = FourCharCode('cmps'); { Refers to the Compositions folder}
  543. kFontCollectionsFolderType = FourCharCode('fncl'); { Refers to the FontCollections folder}
  544. kiMovieFolderType = FourCharCode('imov'); { Refers to the iMovie folder}
  545. kiMoviePlugInsFolderType = FourCharCode('impi'); { Refers to the Plug-ins subfolder of the iMovie Folder}
  546. kiMovieSoundEffectsFolderType = FourCharCode('imse'); { Refers to the Sound Effects subfolder of the iMovie Folder}
  547. kDownloadsFolderType = FourCharCode('down'); { Refers to the ~/Downloads folder}
  548. const
  549. kColorSyncProfilesFolderType = FourCharCode('prof'); { for ColorSyncª Profiles }
  550. kApplicationSupportFolderType = FourCharCode('asup'); { third-party items and folders }
  551. kTextEncodingsFolderType = FourCharCode('Ätex'); { encoding tables }
  552. kPrinterDescriptionFolderType = FourCharCode('ppdf'); { new folder at root of System folder for printer descs. }
  553. kPrinterDriverFolderType = FourCharCode('Äprd'); { new folder at root of System folder for printer drivers }
  554. kScriptingAdditionsFolderType = FourCharCode('Äscr'); { at root of system folder }
  555. const
  556. kClassicPreferencesFolderType = FourCharCode('cprf'); { "Classic" folder in ~/Library/ for redirected preference files. }
  557. const
  558. kQuickLookFolderType = FourCharCode('qlck'); { The QuickLook folder, supported in Mac OS X 10.6 and later. }
  559. const
  560. kServicesFolderType = FourCharCode('svcs'); { The services folder, supported in Mac OS X 10.7 and later. }
  561. const
  562. { The following selectors really only make sense when used within the Classic environment on Mac OS X.}
  563. kSystemFolderType = FourCharCode('macs'); { the system folder }
  564. kSystemDesktopFolderType = FourCharCode('sdsk'); { the desktop folder at the root of the hard drive, never the redirected user desktop folder }
  565. kSystemTrashFolderType = FourCharCode('strs'); { the trash folder at the root of the drive, never the redirected user trash folder }
  566. kPrintMonitorDocsFolderType = FourCharCode('prnt'); { Print Monitor documents }
  567. kALMModulesFolderType = FourCharCode('walk'); { for Location Manager Module files except type 'thng' (within kExtensionFolderType) }
  568. kALMPreferencesFolderType = FourCharCode('trip'); { for Location Manager Preferences (within kPreferencesFolderType; contains kALMLocationsFolderType) }
  569. kALMLocationsFolderType = FourCharCode('fall'); { for Location Manager Locations (within kALMPreferencesFolderType) }
  570. kAppleExtrasFolderType = FourCharCode('aexÄ'); { for Apple Extras folder }
  571. kContextualMenuItemsFolderType = FourCharCode('cmnu'); { for Contextual Menu items }
  572. kMacOSReadMesFolderType = FourCharCode('morÄ'); { for MacOS ReadMes folder }
  573. kStartupFolderType = FourCharCode('strt'); { Finder objects (applications, documents, DAs, aliases, to...) to open at startup go here }
  574. kShutdownFolderType = FourCharCode('shdf'); { Finder objects (applications, documents, DAs, aliases, to...) to open at shutdown go here }
  575. kAppleMenuFolderType = FourCharCode('amnu'); { Finder objects to put into the Apple menu go here }
  576. kControlPanelFolderType = FourCharCode('ctrl'); { Control Panels go here (may contain INITs) }
  577. kSystemControlPanelFolderType = FourCharCode('sctl'); { System control panels folder - never the redirected one, always "Control Panels" inside the System Folder }
  578. kExtensionFolderType = FourCharCode('extn'); { System extensions go here }
  579. kExtensionDisabledFolderType = FourCharCode('extD');
  580. kControlPanelDisabledFolderType = FourCharCode('ctrD');
  581. kSystemExtensionDisabledFolderType = FourCharCode('macD');
  582. kStartupItemsDisabledFolderType = FourCharCode('strD');
  583. kShutdownItemsDisabledFolderType = FourCharCode('shdD');
  584. kAssistantsFolderType = FourCharCode('astÄ'); { for Assistants (MacOS Setup Assistant, etc) }
  585. kStationeryFolderType = FourCharCode('odst'); { stationery }
  586. kOpenDocFolderType = FourCharCode('odod'); { OpenDoc root }
  587. kOpenDocShellPlugInsFolderType = FourCharCode('odsp'); { OpenDoc Shell Plug-Ins in OpenDoc folder }
  588. kEditorsFolderType = FourCharCode('oded'); { OpenDoc editors in MacOS Folder }
  589. kOpenDocEditorsFolderType = FourCharCode('Äodf'); { OpenDoc subfolder of Editors folder }
  590. kOpenDocLibrariesFolderType = FourCharCode('odlb'); { OpenDoc libraries folder }
  591. kGenEditorsFolderType = FourCharCode('Äedi'); { CKH general editors folder at root level of Sys folder }
  592. kHelpFolderType = FourCharCode('Ählp'); { CKH help folder currently at root of system folder }
  593. kInternetPlugInFolderType = FourCharCode('Änet'); { CKH internet plug ins for browsers and stuff }
  594. kModemScriptsFolderType = FourCharCode('Ämod'); { CKH modem scripts, get 'em OUT of the Extensions folder }
  595. kControlStripModulesFolderType = FourCharCode('sdev'); { CKH for control strip modules }
  596. kInternetFolderType = FourCharCode('intÄ'); { Internet folder (root level of startup volume) }
  597. kAppearanceFolderType = FourCharCode('appr'); { Appearance folder (root of system folder) }
  598. kSoundSetsFolderType = FourCharCode('snds'); { Sound Sets folder (in Appearance folder) }
  599. kDesktopPicturesFolderType = FourCharCode('dtpÄ'); { Desktop Pictures folder (in Appearance folder) }
  600. kFindSupportFolderType = FourCharCode('fnds'); { Find support folder }
  601. kRecentApplicationsFolderType = FourCharCode('rapp'); { Recent Applications folder }
  602. kRecentDocumentsFolderType = FourCharCode('rdoc'); { Recent Documents folder }
  603. kRecentServersFolderType = FourCharCode('rsvr'); { Recent Servers folder }
  604. kLauncherItemsFolderType = FourCharCode('laun'); { Launcher Items folder }
  605. kQuickTimeExtensionsFolderType = FourCharCode('qtex'); { QuickTime Extensions Folder (in Extensions folder) }
  606. kDisplayExtensionsFolderType = FourCharCode('dspl'); { Display Extensions Folder (in Extensions folder) }
  607. kMultiprocessingFolderType = FourCharCode('mpxf'); { Multiprocessing Folder (in Extensions folder) }
  608. kPrintingPlugInsFolderType = FourCharCode('pplg'); { Printing Plug-Ins Folder (in Extensions folder) }
  609. kAppleshareAutomountServerAliasesFolderType = FourCharCode('srvÄ'); { Appleshare puts volumes to automount inside this folder. }
  610. kVolumeSettingsFolderType = FourCharCode('vsfd'); { Volume specific user information goes here }
  611. kPreMacOS91ApplicationsFolderType = FourCharCode('Œpps'); { The "Applications" folder, pre Mac OS 9.1 }
  612. kPreMacOS91InstallerLogsFolderType = FourCharCode('”lgf'); { The "Installer Logs" folder, pre Mac OS 9.1 }
  613. kPreMacOS91AssistantsFolderType = FourCharCode('ŒstÄ'); { The "Assistants" folder, pre Mac OS 9.1 }
  614. kPreMacOS91UtilitiesFolderType = FourCharCode('ŸtiÄ'); { The "Utilities" folder, pre Mac OS 9.1 }
  615. kPreMacOS91AppleExtrasFolderType = FourCharCode('ŒexÄ'); { The "Apple Extras" folder, pre Mac OS 9.1 }
  616. kPreMacOS91MacOSReadMesFolderType = FourCharCode('µorÄ'); { The "Mac OS ReadMes" folder, pre Mac OS 9.1 }
  617. kPreMacOS91InternetFolderType = FourCharCode('”ntÄ'); { The "Internet" folder, pre Mac OS 9.1 }
  618. kPreMacOS91AutomountedServersFolderType = FourCharCode('§rvÄ'); { The "Servers" folder, pre Mac OS 9.1 }
  619. kPreMacOS91StationeryFolderType = FourCharCode('¿dst'); { The "Stationery" folder, pre Mac OS 9.1 }
  620. kLocalesFolderType = FourCharCode('Äloc'); { PKE for Locales folder }
  621. kFindByContentPluginsFolderType = FourCharCode('fbcp'); { Find By Content Plug-ins }
  622. kFindByContentFolderType = FourCharCode('fbcf'); { Find by content folder }
  623. { These folder types are not supported on Mac OS X at all and should be removed from your source code.}
  624. const
  625. kMagicTemporaryItemsFolderType = FourCharCode('mtmp');
  626. kTemporaryItemsInUserDomainFolderType = FourCharCode('temq');
  627. kCurrentUserRemoteFolderLocation = FourCharCode('rusf'); { The remote folder for the currently logged on user }
  628. kCurrentUserRemoteFolderType = FourCharCode('rusr'); { The remote folder location for the currently logged on user }
  629. {
  630. These folder types are deprecated in 10.5. The location of developer tools is no longer hard coded to "/Developer/" and
  631. so these folder types work only when developer tools are installed at the default location.
  632. }
  633. const
  634. kDeveloperDocsFolderType = FourCharCode('ddoc'); { Deprecated in 10.5. Contains Developer Documentation files and folders}
  635. kDeveloperHelpFolderType = FourCharCode('devh'); { Deprecated in 10.5. Contains Developer Help related files}
  636. kDeveloperFolderType = FourCharCode('devf'); { Deprecated in 10.5. Contains MacOS X Developer Resources}
  637. kDeveloperApplicationsFolderType = FourCharCode('dapp'); { Deprecated in 10.5. Contains Developer Applications}
  638. { FolderDescFlags values }
  639. const
  640. kCreateFolderAtBoot = $00000002;
  641. kCreateFolderAtBootBit = 1;
  642. kFolderCreatedInvisible = $00000004;
  643. kFolderCreatedInvisibleBit = 2;
  644. kFolderCreatedNameLocked = $00000008;
  645. kFolderCreatedNameLockedBit = 3;
  646. kFolderCreatedAdminPrivs = $00000010;
  647. kFolderCreatedAdminPrivsBit = 4;
  648. const
  649. kFolderInUserFolder = $00000020;
  650. kFolderInUserFolderBit = 5;
  651. kFolderTrackedByAlias = $00000040;
  652. kFolderTrackedByAliasBit = 6;
  653. kFolderInRemoteUserFolderIfAvailable = $00000080;
  654. kFolderInRemoteUserFolderIfAvailableBit = 7;
  655. kFolderNeverMatchedInIdentifyFolder = $00000100;
  656. kFolderNeverMatchedInIdentifyFolderBit = 8;
  657. kFolderMustStayOnSameVolume = $00000200;
  658. kFolderMustStayOnSameVolumeBit = 9;
  659. kFolderManagerFolderInMacOS9FolderIfMacOSXIsInstalledMask = $00000400;
  660. kFolderManagerFolderInMacOS9FolderIfMacOSXIsInstalledBit = 10;
  661. kFolderInLocalOrRemoteUserFolder = kFolderInUserFolder or kFolderInRemoteUserFolderIfAvailable;
  662. kFolderManagerNotCreatedOnRemoteVolumesBit = 11;
  663. kFolderManagerNotCreatedOnRemoteVolumesMask = 1 shl kFolderManagerNotCreatedOnRemoteVolumesBit;
  664. kFolderManagerNewlyCreatedFolderIsLocalizedBit = 12;
  665. kFolderManagerNewlyCreatedFolderShouldHaveDotLocalizedCreatedWithinMask = 1 shl kFolderManagerNewlyCreatedFolderIsLocalizedBit;
  666. type
  667. FolderDescFlags = UInt32;
  668. { FolderClass values }
  669. const
  670. kRelativeFolder = FourCharCode('relf');
  671. kRedirectedRelativeFolder = FourCharCode('rrel');
  672. kSpecialFolder = FourCharCode('spcf');
  673. type
  674. FolderClass = OSType;
  675. { special folder locations }
  676. const
  677. kBlessedFolder = FourCharCode('blsf');
  678. kRootFolder = FourCharCode('rotf');
  679. const
  680. kCurrentUserFolderLocation = FourCharCode('cusf'); { the magic 'Current User' folder location}
  681. const
  682. kDictionariesFolderType = FourCharCode('dict'); { Dictionaries folder }
  683. kLogsFolderType = FourCharCode('logs'); { Logs folder }
  684. kPreferencePanesFolderType = FourCharCode('ppan'); { PreferencePanes folder, in .../Library/ }
  685. const
  686. kWidgetsFolderType = FourCharCode('wdgt'); { Dashboard Widgets folder, in system, local, and user domains }
  687. kScreenSaversFolderType = FourCharCode('scrn'); { Screen Savers folder, in system, local, and user domains }
  688. type
  689. FolderType = OSType;
  690. FolderLocation = OSType;
  691. type
  692. FolderDesc = record
  693. descSize: Size;
  694. foldType: FolderType;
  695. flags: FolderDescFlags;
  696. foldClass: FolderClass;
  697. foldLocation: FolderType;
  698. badgeSignature: OSType;
  699. badgeType: OSType;
  700. reserved: UInt32;
  701. name: StrFileName; { Str63 on MacOS}
  702. end;
  703. FolderDescPtr = ^FolderDesc;
  704. type
  705. RoutingFlags = UInt32;
  706. FolderRouting = record
  707. descSize: Size;
  708. fileType: OSType;
  709. routeFromFolder: FolderType;
  710. routeToFolder: FolderType;
  711. flags: RoutingFlags;
  712. end;
  713. FolderRoutingPtr = ^FolderRouting;
  714. {
  715. * AddFolderDescriptor()
  716. *
  717. * Summary:
  718. * Copies the supplied information into a new folder descriptor
  719. * entry in the system folder list. @discussion The
  720. * AddFolderDescriptor function copies the supplied information into
  721. * a new descriptor entry in the system folder list. You need to
  722. * provide folder descriptors for each folder you wish the Folder
  723. * Manager to be able to find via the function FindFolder. For
  724. * example, a child folder located in a parent folder needs to have
  725. * a descriptor created both for it and its parent folder, so that
  726. * the child can be found. This function is supported under Mac OS 8
  727. * and later.
  728. * On Mac OS X, folder descriptors added in one process are not
  729. * visible in other processes.
  730. *
  731. * Mac OS X threading:
  732. * Thread safe since version 10.3
  733. *
  734. * Parameters:
  735. *
  736. * foldType:
  737. * Pass a constant identifying the type of the folder you wish the
  738. * Folder Manager to be able to find. See ÒFolder Type ConstantsÓ.
  739. *
  740. * flags:
  741. * Set these flags to indicate whether a folder is created during
  742. * startup, if the folder name is locked, and if the folder is
  743. * created invisible; see ÒFolder Descriptor FlagsÓ.
  744. *
  745. * foldClass:
  746. * Pass the class of the folder which you wish the Folder Manager
  747. * to be able to find. The folder class determines how the
  748. * foldLocation parameter is interpreted. See "Folder Descriptor
  749. * Classes" for a discussion of relative and special folder
  750. * classes.
  751. *
  752. * foldLocation:
  753. * For a relative folder, specify the folder type of the parent
  754. * folder of the target. For a special folder, specify the
  755. * location of the folder; see ÒFolder Descriptor LocationsÓ.
  756. *
  757. * badgeSignature:
  758. * Reserved. Pass 0.
  759. *
  760. * badgeType:
  761. * Reserved. Pass 0.
  762. *
  763. * name:
  764. * A string specifying the name of the desired folder. For
  765. * relative folders, this is the exact name of the desired folder.
  766. * For special folders, the actual target folder may have a
  767. * different name than the name specified in the folder
  768. * descriptor. For example, the System Folder is often given a
  769. * different name, but it can still be located with FindFolder.
  770. *
  771. * replaceFlag:
  772. * Pass a Boolean value indicating whether you wish to replace a
  773. * folder descriptor that already exists for the specified folder
  774. * type. If true , it replaces the folder descriptor for the
  775. * specified folder type. If false , it does not replace the
  776. * folder descriptor for the specified folder type.
  777. *
  778. * Availability:
  779. * Mac OS X: in version 10.0 and later in CoreServices.framework
  780. * CarbonLib: in CarbonLib 1.0 and later
  781. * Non-Carbon CFM: in FoldersLib 1.0 and later
  782. }
  783. function AddFolderDescriptor( foldType: FolderType; flags: FolderDescFlags; foldClass: FolderClass; foldLocation: FolderLocation; badgeSignature: OSType; badgeType: OSType; const (*var*) name: StrFileName; replaceFlag: Boolean ): OSErr; external name '_AddFolderDescriptor';
  784. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  785. {
  786. * GetFolderTypes()
  787. *
  788. * Summary:
  789. * Obtains the folder types contained in the global descriptor list.
  790. *
  791. * Mac OS X threading:
  792. * Thread safe since version 10.3
  793. *
  794. * Parameters:
  795. *
  796. * requestedTypeCount:
  797. * Pass the number of FolderType values that can fit in the buffer
  798. * pointed to by the theTypes parameter; see ÒFolder Type
  799. * ConstantsÓ.
  800. *
  801. * totalTypeCount:
  802. * Pass a pointer to an unsigned 32-bit integer value. On return,
  803. * the value is set to the total number of FolderType values in
  804. * the list. The totalTypeCount parameter may produce a value that
  805. * is larger or smaller than that of the requestedTypeCount
  806. * parameter. If totalTypeCount is equal to or smaller than the
  807. * value passed in for requestedTypeCount and the value produced
  808. * by the theTypes parameter is non-null, then all folder types
  809. * were returned to the caller.
  810. *
  811. * theTypes:
  812. * Pass a pointer to an array of FolderType values; see "Folder
  813. * Type Constants". On return, the array contains the folder types
  814. * for the installed descriptors. You can step through the array
  815. * and call GetFolderDescriptor for each folder type. Pass null if
  816. * you only want to know the number of descriptors installed in
  817. * the systemÕs global list, rather than the actual folder types
  818. * of those descriptors.
  819. *
  820. * Availability:
  821. * Mac OS X: in version 10.0 and later in CoreServices.framework
  822. * CarbonLib: in CarbonLib 1.0 and later
  823. * Non-Carbon CFM: in FoldersLib 1.0 and later
  824. }
  825. function GetFolderTypes( requestedTypeCount: UInt32; var totalTypeCount: UInt32; var theTypes: FolderType ): OSErr; external name '_GetFolderTypes';
  826. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  827. {
  828. * RemoveFolderDescriptor()
  829. *
  830. * Summary:
  831. * Deletes the specified folder descriptor entry from the system
  832. * folder list.
  833. *
  834. * Mac OS X threading:
  835. * Thread safe since version 10.3
  836. *
  837. * Parameters:
  838. *
  839. * foldType:
  840. * Pass a constant identifying the type of the folder for which
  841. * you wish to remove a descriptor.
  842. *
  843. * Availability:
  844. * Mac OS X: in version 10.0 and later in CoreServices.framework
  845. * CarbonLib: in CarbonLib 1.0 and later
  846. * Non-Carbon CFM: in FoldersLib 1.0 and later
  847. }
  848. function RemoveFolderDescriptor( foldType: FolderType ): OSErr; external name '_RemoveFolderDescriptor';
  849. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  850. {
  851. * GetFolderNameUnicode()
  852. *
  853. * Summary:
  854. * Obtains the name of the specified folder.
  855. *
  856. * Discussion:
  857. * The GetFolderName function obtains the name of the folder in the
  858. * folder descriptor, not the name of the folder on the disk. The
  859. * names may differ for a few special folders such as the System
  860. * Folder. For relative folders, however, the actual name is always
  861. * returned. You typically do not need to call this function.
  862. *
  863. * Mac OS X threading:
  864. * Thread safe since version 10.5
  865. *
  866. * Parameters:
  867. *
  868. * vRefNum:
  869. * Pass the volume reference number (or the constant kOnSystemDisk
  870. * for the startup disk) of the volume containing the folder for
  871. * which you wish the name to be identified.
  872. *
  873. * foldType:
  874. * Pass a constant identifying the type of the folder for which
  875. * you wish the name to be identified. See "Folder Type Constants".
  876. *
  877. * foundVRefNum:
  878. * On return, a pointer to the volume reference number for the
  879. * volume containing the folder specified in the foldType
  880. * parameter.
  881. *
  882. * name:
  883. * A pointer to an HFSUniStr255 which will contain the unicode
  884. * name on return.
  885. *
  886. * Availability:
  887. * Mac OS X: in version 10.5 and later in CoreServices.framework
  888. * CarbonLib: not available
  889. * Non-Carbon CFM: not available
  890. }
  891. function GetFolderNameUnicode( vRefNum: FSVolumeRefNum; foldType: OSType; var foundVRefNum: FSVolumeRefNum; var name: HFSUniStr255 ): OSStatus; external name '_GetFolderNameUnicode';
  892. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  893. {
  894. * InvalidateFolderDescriptorCache()
  895. *
  896. * Summary:
  897. * Invalidates any prior FindFolder results for the specified folder.
  898. *
  899. * Discussion:
  900. * The InvalidateFolderDescriptorCache function searches to see if
  901. * there is currently a cache of results from FindFolder calls on
  902. * the specified folder. If so, it invalidates the cache from the
  903. * previous calls to the FindFolder function in order to force the
  904. * Folder Manager to reexamine the disk when FindFolder is called
  905. * again on the specified directory ID or volume reference number.
  906. *
  907. *
  908. * You should not normally need to call
  909. * InvalidateFolderDescriptorCache.
  910. *
  911. * Mac OS X threading:
  912. * Thread safe since version 10.3
  913. *
  914. * Parameters:
  915. *
  916. * vRefNum:
  917. * Pass the volume reference number (or the constant kOnSystemDisk
  918. * for the startup disk) of the volume containing the folder for
  919. * which you wish the descriptor cache to be invalidated. Pass 0
  920. * to completely invalidate all folder cache information.
  921. *
  922. * dirID:
  923. * Pass the directory ID number for the folder for which you wish
  924. * the descriptor cache to be invalidated. Pass 0 to invalidate
  925. * the cache for all folders on the specified disk.
  926. *
  927. * Availability:
  928. * Mac OS X: in version 10.0 and later in CoreServices.framework
  929. * CarbonLib: in CarbonLib 1.0 and later
  930. * Non-Carbon CFM: in FoldersLib 1.0 and later
  931. }
  932. function InvalidateFolderDescriptorCache( vRefNum: FSVolumeRefNum; dirID: SInt32 ): OSErr; external name '_InvalidateFolderDescriptorCache';
  933. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  934. {
  935. * IdentifyFolder()
  936. *
  937. * Summary:
  938. * Obtains the folder type for the specified folder.
  939. *
  940. * Discussion:
  941. * The folder type is identified for the folder specified by the
  942. * vRefNum and dirID parameters, if such a folder exists. Note that
  943. * IdentifyFolder may take several seconds to complete. Note also
  944. * that if there are multiple folder descriptors that map to an
  945. * individual folder, IdentifyFolder returns the folder type of only
  946. * the first matching descriptor that it finds.
  947. *
  948. * Mac OS X threading:
  949. * Thread safe since version 10.3
  950. *
  951. * Parameters:
  952. *
  953. * vRefNum:
  954. * Pass the volume reference number (or the constant kOnSystemDisk
  955. * for the startup disk) of the volume containing the folder whose
  956. * type you wish to identify.
  957. *
  958. * dirID:
  959. * Pass the directory ID number for the folder whose type you wish
  960. * to identify.
  961. *
  962. * foldType:
  963. * Pass a pointer to a value of type FolderType. On return, the
  964. * value is set to the folder type of the folder with the
  965. * specified vRefNum and dirID parameters; see "Folder Type
  966. * Constants" for descriptions of possible values.
  967. *
  968. * Availability:
  969. * Mac OS X: in version 10.0 and later in CoreServices.framework
  970. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  971. * Non-Carbon CFM: not available
  972. }
  973. function IdentifyFolder( vRefNum: FSVolumeRefNum; dirID: SInt32; var foldType: FolderType ): OSErr; external name '_IdentifyFolder';
  974. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  975. {
  976. * FSDetermineIfRefIsEnclosedByFolder()
  977. *
  978. * Summary:
  979. * Determine whether the given FSRef is enclosed inside the given
  980. * special folder type for the given domain.
  981. *
  982. * Discussion:
  983. * This is a fairly fast call which can determine whether a given
  984. * FSRef on disk is 'inside' the given special folder type for the
  985. * given domain. This call will be more efficient than the
  986. * equivalent client code which walked up the file list, checking
  987. * each parent with IdentifyFolder() to see if it matches. One use
  988. * for this call is to determine if a given file or folder is inside
  989. * the trash on a volume, with something like
  990. *
  991. * err = FSDetermineIfRefIsEnclosedByFolder( kOnAppropriateDisk,
  992. * kTrashFolderType, & ref, & result );
  993. * if ( err == noErr && result ) (
  994. * // FSRef is inside trash on the volume.<br> )
  995. *
  996. * Mac OS X threading:
  997. * Thread safe since version 10.4
  998. *
  999. * Parameters:
  1000. *
  1001. * domainOrVRefNum:
  1002. * The domain or vRefNum to check. You can also pass
  1003. * kOnAppropriateDisk to check whatever vRefNum is appropriate for
  1004. * the given FSRef, or the value 0 to check all vRefNums and
  1005. * domains.
  1006. *
  1007. * folderType:
  1008. * The folder type to check
  1009. *
  1010. * inRef:
  1011. * The FSRef to look for.
  1012. *
  1013. * outResult:
  1014. * If non-NULL, this will be filled in with true if the given
  1015. * FSRef is enclosed inside the special folder type for the given
  1016. * domain, or false otherwise.
  1017. *
  1018. * Availability:
  1019. * Mac OS X: in version 10.4 and later in CoreServices.framework
  1020. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  1021. * Non-Carbon CFM: not available
  1022. }
  1023. function FSDetermineIfRefIsEnclosedByFolder( domainOrVRefNum: FSVolumeRefNum; folderType: OSType; const (*var*) inRef: FSRef; var outResult: Boolean ): OSErr; external name '_FSDetermineIfRefIsEnclosedByFolder';
  1024. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1025. {
  1026. * DetermineIfPathIsEnclosedByFolder()
  1027. *
  1028. * Summary:
  1029. * Determine whether a file path is enclosed inside the given
  1030. * special folder type for the given domain.
  1031. *
  1032. * Discussion:
  1033. * This is a fairly fast call which can determine whether a given
  1034. * path on disk is 'inside' the given special folder type for the
  1035. * given domain. This call will be more efficient than the
  1036. * equivalent client code which walked up the file list, checking
  1037. * each parent with IdentifyFolder() to see if it matches. One use
  1038. * for this call is to determine if a given file or folder is inside
  1039. * the trash on a volume, with something like
  1040. *
  1041. * err = DetermineIfPathIsEnclosedByFolder( kOnAppropriateDisk,
  1042. * kTrashFolderType, path, false, & result );
  1043. * if ( err == noErr && result ) (
  1044. * // path is inside trash on the volume.<br> )
  1045. *
  1046. * Mac OS X threading:
  1047. * Thread safe since version 10.4
  1048. *
  1049. * Parameters:
  1050. *
  1051. * domainOrVRefNum:
  1052. * The domain or vRefNum to check. You can also pass
  1053. * kOnAppropriateDisk to check whatever vRefNum is appropriate for
  1054. * the given path, or the value 0 to check all vRefNums and
  1055. * domains.
  1056. *
  1057. * folderType:
  1058. * The folder type to check
  1059. *
  1060. * utf8Path:
  1061. * A UTF-8 encoded path name for the file.
  1062. *
  1063. * pathIsRealPath:
  1064. * Pass true if utf8Path is guaranteed to be a real pathname, with
  1065. * no symlinks or relative pathname items. Pass false if the
  1066. * utf8Path may contain relative pathnames, or symlinks, or
  1067. * aliases, etc.
  1068. *
  1069. * outResult:
  1070. * If non-NULL, this will be filled in with true if the given path
  1071. * is enclosed inside the special folder type for the given
  1072. * domain, or false otherwise.
  1073. *
  1074. * Availability:
  1075. * Mac OS X: in version 10.4 and later in CoreServices.framework
  1076. * CarbonLib: in CarbonLib 1.0 and later
  1077. * Non-Carbon CFM: in FoldersLib 1.0 and later
  1078. }
  1079. function DetermineIfPathIsEnclosedByFolder( domainOrVRefNum: FSVolumeRefNum; folderType: OSType; utf8Path: ConstCStringPtr; pathIsRealPath: Boolean; var outResult: Boolean ): OSErr; external name '_DetermineIfPathIsEnclosedByFolder';
  1080. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1081. {$ifc not TARGET_CPU_64}
  1082. {
  1083. * FindFolderExtended() *** DEPRECATED ***
  1084. *
  1085. * Deprecated:
  1086. * Use FindFolder instead wherever possible.
  1087. *
  1088. * Summary:
  1089. * Obtains location information for system-related directories.
  1090. *
  1091. * Discussion:
  1092. * For the folder type on the particular volume (specified,
  1093. * respectively, in the folderType and vRefNum parameters), the
  1094. * FindFolder function returns the directory's volume reference
  1095. * number in the foundVRefNum parameter and its directory ID in the
  1096. * foundDirID parameter.
  1097. *
  1098. * The specified folder used for a given volume might be located on
  1099. * a different volume in future versions of system software;
  1100. * therefore, do not assume the volume that you specify in vRefNum
  1101. * and the volume returned in foundVRefNum will be the same.
  1102. *
  1103. * Specify a volume reference number (or the constant kOnSystemDisk
  1104. * for the startup disk) or one of the domain constants ( on Mac OS
  1105. * X ) in the vRefNum parameter.
  1106. *
  1107. * Specify a four-character folder type--or the constant that
  1108. * represents it--in the folderType parameter.
  1109. *
  1110. * Use the constant kCreateFolder in the createFolder parameter to
  1111. * tell FindFolder to create a directory if it does not already
  1112. * exist; otherwise, use the constant kDontCreateFolder. Directories
  1113. * inside the System Folder are created only if the System Folder
  1114. * directory exists. The FindFolder function will not create a
  1115. * System Folder directory even if you specify the kCreateFolder
  1116. * constant in the createFolder parameter.
  1117. *
  1118. * The FindFolder function returns a nonzero result code if the
  1119. * folder isn't found, and it can also return other file system
  1120. * errors reported by the File Manager or Memory Manager.
  1121. * FindFolderExtended() is equivalent to FindFolder() on Mac OS X.
  1122. *
  1123. * Mac OS X threading:
  1124. * Thread safe since version 10.3
  1125. *
  1126. * Parameters:
  1127. *
  1128. * vRefNum:
  1129. * The volume reference number (or the constant kOnSystemDisk for
  1130. * the startup disk) or one of the domain constants ( like
  1131. * kUserDomain ) of the volume or domain in which you want to
  1132. * locate a directory.
  1133. *
  1134. * folderType:
  1135. * A four-character folder type, or a constant that represents the
  1136. * type, for the directory you want to find.
  1137. *
  1138. * createFolder:
  1139. * Pass the constant kCreateFolder in this parameter to create a
  1140. * directory if it does not already exist; otherwise, pass the
  1141. * constant kDontCreateFolder.
  1142. *
  1143. * foundVRefNum:
  1144. * The volume reference number, returned by FindFolder , for the
  1145. * volume containing the directory you specify in the folderType
  1146. * parameter.
  1147. *
  1148. * flags:
  1149. * The flags passed in which control extended behaviour
  1150. *
  1151. * data:
  1152. * Unique data which is interpreted differently depending on the
  1153. * passed in flags.
  1154. *
  1155. * foundDirID:
  1156. * The directory ID number, returned by FindFolder , for the
  1157. * directory you specify in the folderType parameter.
  1158. *
  1159. * Availability:
  1160. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
  1161. * CarbonLib: in CarbonLib 1.0 and later
  1162. * Non-Carbon CFM: in InterfaceLib 9.0 and later
  1163. }
  1164. function FindFolderExtended( vRefNum: FSVolumeRefNum; folderType: OSType; createFolder: Boolean; flags: UInt32; data: UnivPtr; var foundVRefNum: FSVolumeRefNum; var foundDirID: SInt32 ): OSErr; external name '_FindFolderExtended';
  1165. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
  1166. {
  1167. * FSFindFolderExtended() *** DEPRECATED ***
  1168. *
  1169. * Summary:
  1170. * FSFindFolderExtended returns an FSRef for certain system-related
  1171. * directories.
  1172. *
  1173. * Discussion:
  1174. * For the folder type on the particular volume (specified,
  1175. * respectively, in the folderType and vRefNum parameters), the
  1176. * FindFolder function returns the FSRef of that directory.
  1177. *
  1178. * The specified folder used for a given volume might be located on
  1179. * a different volume in future versions of system software;
  1180. * therefore, do not assume the volume that you specify in vRefNum
  1181. * and the volume returned in the FSRef will be the same.
  1182. *
  1183. * Specify a volume reference number (or the constant kOnSystemDisk
  1184. * for the startup disk) or one of the domain constants ( on Mac OS
  1185. * X ) in the vRefNum parameter.
  1186. *
  1187. * Specify a four-character folder type--or the constant that
  1188. * represents it--in the folderType parameter.
  1189. *
  1190. * Use the constant kCreateFolder in the createFolder parameter to
  1191. * tell FindFolder to create a directory if it does not already
  1192. * exist; otherwise, use the constant kDontCreateFolder. Directories
  1193. * inside the System Folder are created only if the System Folder
  1194. * directory exists. The FindFolder function will not create a
  1195. * System Folder directory even if you specify the kCreateFolder
  1196. * constant in the createFolder parameter.
  1197. *
  1198. * The FindFolder function returns a nonzero result code if the
  1199. * folder isn't found, and it can also return other file system
  1200. * errors reported by the File Manager or Memory Manager.
  1201. *
  1202. * Mac OS X threading:
  1203. * Thread safe since version 10.3
  1204. *
  1205. * Parameters:
  1206. *
  1207. * vRefNum:
  1208. * The volume reference number (or the constant kOnSystemDisk for
  1209. * the startup disk) or one of the domain constants ( like
  1210. * kUserDomain ) of the volume or domain in which you want to
  1211. * locate a directory.
  1212. *
  1213. * folderType:
  1214. * A four-character folder type, or a constant that represents the
  1215. * type, for the directory you want to find.
  1216. *
  1217. * createFolder:
  1218. * Pass the constant kCreateFolder in this parameter to create a
  1219. * directory if it does not already exist; otherwise, pass the
  1220. * constant kDontCreateFolder.
  1221. *
  1222. * flags:
  1223. * The flags passed in which control extended behaviour
  1224. *
  1225. * data:
  1226. * Unique data which is interpreted differently depending on the
  1227. * passed in flags.
  1228. *
  1229. * foundRef:
  1230. * The FSRef for the directory you specify on the volume or domain
  1231. * and folderType given.
  1232. *
  1233. * Availability:
  1234. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
  1235. * CarbonLib: in CarbonLib 1.1 and later
  1236. * Non-Carbon CFM: in InterfaceLib 9.1 and later
  1237. }
  1238. function FSFindFolderExtended( vRefNum: FSVolumeRefNum; folderType: OSType; createFolder: Boolean; flags: UInt32; data: UnivPtr; var foundRef: FSRef ): OSErr; external name '_FSFindFolderExtended';
  1239. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
  1240. {
  1241. * GetFolderDescriptor() *** DEPRECATED ***
  1242. *
  1243. * Deprecated:
  1244. * GetFolderDescriptor is deprecated on Mac OS X.
  1245. *
  1246. * Summary:
  1247. * Obtains the folder descriptor information for the specified
  1248. * folder type from the global descriptor list.
  1249. *
  1250. * Mac OS X threading:
  1251. * Thread safe since version 10.3
  1252. *
  1253. * Parameters:
  1254. *
  1255. * foldType:
  1256. * Pass a constant identifying the type of the folder for which
  1257. * you wish to get descriptor information. See "Folder Type
  1258. * Constants".
  1259. *
  1260. * descSize:
  1261. * Pass the size (in bytes) of the folder descriptor structure for
  1262. * which a pointer is passed in the foldDesc parameter. This value
  1263. * is needed in order to determine the version of the structure
  1264. * being used.
  1265. *
  1266. * foldDesc:
  1267. * Pass a pointer to a folder descriptor structure. On return, the
  1268. * folder descriptor structure contains information from the
  1269. * global descriptor list for the specified folder type.
  1270. *
  1271. * Availability:
  1272. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
  1273. * CarbonLib: in CarbonLib 1.0 and later
  1274. * Non-Carbon CFM: in FoldersLib 1.0 and later
  1275. }
  1276. function GetFolderDescriptor( foldType: FolderType; descSize: Size; var foldDesc: FolderDesc ): OSErr; external name '_GetFolderDescriptor';
  1277. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
  1278. {
  1279. * GetFolderName() *** DEPRECATED ***
  1280. *
  1281. * Deprecated:
  1282. * Use GetFolderNameUnicode.
  1283. *
  1284. * Summary:
  1285. * Obtains the name of the specified folder.
  1286. *
  1287. * Discussion:
  1288. * The GetFolderName function obtains the name of the folder in the
  1289. * folder descriptor, not the name of the folder on the disk. The
  1290. * names may differ for a few special folders such as the System
  1291. * Folder. For relative folders, however, the actual name is always
  1292. * returned. You typically do not need to call this function.
  1293. *
  1294. * Mac OS X threading:
  1295. * Thread safe since version 10.3
  1296. *
  1297. * Parameters:
  1298. *
  1299. * vRefNum:
  1300. * Pass the volume reference number (or the constant kOnSystemDisk
  1301. * for the startup disk) of the volume containing the folder for
  1302. * which you wish the name to be identified.
  1303. *
  1304. * foldType:
  1305. * Pass a constant identifying the type of the folder for which
  1306. * you wish the name to be identified. See "Folder Type Constants".
  1307. *
  1308. * foundVRefNum:
  1309. * On return, a pointer to the volume reference number for the
  1310. * volume containing the folder specified in the foldType
  1311. * parameter.
  1312. *
  1313. * name:
  1314. * On return, a string containing the title of the folder
  1315. * specified in the foldType and vRefNum parameters.
  1316. *
  1317. * Availability:
  1318. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.5
  1319. * CarbonLib: in CarbonLib 1.0 and later
  1320. * Non-Carbon CFM: in FoldersLib 1.0 and later
  1321. }
  1322. function GetFolderName( vRefNum: FSVolumeRefNum; foldType: OSType; var foundVRefNum: FSVolumeRefNum; var name: StrFileName ): OSErr; external name '_GetFolderName';
  1323. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_5, __IPHONE_NA, __IPHONE_NA) *)
  1324. {
  1325. * AddFolderRouting() *** DEPRECATED ***
  1326. *
  1327. * Deprecated:
  1328. * Folder Manager routing is deprecated on Mac OS X. Do not rely on
  1329. * this feature in your application, because support for it will be
  1330. * removed in a future version of the OS.
  1331. *
  1332. * Summary:
  1333. * Adds a folder routing structure to the global routing list.
  1334. *
  1335. * Discussion:
  1336. * Your application can use the AddFolderRouting function to specify
  1337. * how the Finder routes a given file type.
  1338. * Folder Routing is deprecated on Mac OS X at this time.
  1339. *
  1340. * Mac OS X threading:
  1341. * Thread safe since version 10.3
  1342. *
  1343. * Parameters:
  1344. *
  1345. * fileType:
  1346. * Pass the OSType of the file to be routed.
  1347. *
  1348. * routeFromFolder:
  1349. * Pass the folder type of the "from" folder see "Folder Type
  1350. * Constants" for descriptions of possible values. An item dropped
  1351. * on the folder specified in this parameter will be routed to the
  1352. * folder specified in the routeToFolder parameter.
  1353. *
  1354. * routeToFolder:
  1355. * The folder type of the "to" folder see "Folder Type Constants"
  1356. * for descriptions of possible values.
  1357. *
  1358. * flags:
  1359. * Reserved for future use; pass 0.
  1360. *
  1361. * replaceFlag:
  1362. * Pass a Boolean value indicating whether you wish to replace a
  1363. * folder routing that already exists. If true , it replaces the
  1364. * folder to which the item is being routed. If false , it leaves
  1365. * the folder to which the item is being routed.
  1366. *
  1367. * Availability:
  1368. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  1369. * CarbonLib: in CarbonLib 1.0 and later
  1370. * Non-Carbon CFM: in FoldersLib 1.0 and later
  1371. }
  1372. function AddFolderRouting( fileType: OSType; routeFromFolder: FolderType; routeToFolder: FolderType; flags: RoutingFlags; replaceFlag: Boolean ): OSErr; external name '_AddFolderRouting';
  1373. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  1374. {
  1375. * RemoveFolderRouting() *** DEPRECATED ***
  1376. *
  1377. * Deprecated:
  1378. * Folder Manager routing is deprecated on Mac OS X. Do not rely on
  1379. * this feature in your application, because support for it will be
  1380. * removed in a future version of the OS.
  1381. *
  1382. * Summary:
  1383. * Deletes a folder routing structure from the global routing list.
  1384. *
  1385. * Discussion:
  1386. * Both the file type and the folder type specified must match those
  1387. * of an existing folder routing structure in the global routing
  1388. * list for the RemoveFolderRouting function to succeed.
  1389. *
  1390. * Mac OS X threading:
  1391. * Thread safe since version 10.3
  1392. *
  1393. * Parameters:
  1394. *
  1395. * fileType:
  1396. * Pass the file type value contained in the folder routing
  1397. * structure to be removed.
  1398. *
  1399. * routeFromFolder:
  1400. * Pass the folder type of the "from" folder see "Folder Type
  1401. * Constants" for descriptions of possible values.
  1402. *
  1403. * Availability:
  1404. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  1405. * CarbonLib: in CarbonLib 1.0 and later
  1406. * Non-Carbon CFM: in FoldersLib 1.0 and later
  1407. }
  1408. function RemoveFolderRouting( fileType: OSType; routeFromFolder: FolderType ): OSErr; external name '_RemoveFolderRouting';
  1409. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  1410. {
  1411. * FindFolderRouting() *** DEPRECATED ***
  1412. *
  1413. * Deprecated:
  1414. * Folder Manager routing is deprecated on Mac OS X. Do not rely on
  1415. * this feature in your application, because support for it will be
  1416. * removed in a future version of the OS.
  1417. *
  1418. * Summary:
  1419. * Finds the destination folder from a matching folder routing
  1420. * structure for the specified file.
  1421. *
  1422. * Discussion:
  1423. * Both the file type and the folder type specified must match those
  1424. * of a folder routing structure in the global routing list for the
  1425. * FindFolderRouting function to succeed.
  1426. *
  1427. * Mac OS X threading:
  1428. * Thread safe since version 10.3
  1429. *
  1430. * Parameters:
  1431. *
  1432. * fileType:
  1433. * Pass the file type specified in the appropriate folder routing
  1434. * structure for the file for which you wish to find a destination
  1435. * folder.
  1436. *
  1437. * routeFromFolder:
  1438. * Pass the folder type of the "from" folder for which you wish to
  1439. * find a "to" folder see "Folder Type Constants" for descriptions
  1440. * of possible values. An item dropped on the folder specified in
  1441. * this parameter will be routed to the folder specified in the
  1442. * routeToFolder parameter.
  1443. *
  1444. * routeToFolder:
  1445. * A pointer to a value of type FolderType. On return, the value
  1446. * is set to the folder type of the destination folder.
  1447. *
  1448. * flags:
  1449. * Reserved; pass 0.
  1450. *
  1451. * Availability:
  1452. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  1453. * CarbonLib: in CarbonLib 1.0 and later
  1454. * Non-Carbon CFM: in FoldersLib 1.0 and later
  1455. }
  1456. function FindFolderRouting( fileType: OSType; routeFromFolder: FolderType; var routeToFolder: FolderType; var flags: RoutingFlags ): OSErr; external name '_FindFolderRouting';
  1457. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  1458. {
  1459. * GetFolderRoutings() *** DEPRECATED ***
  1460. *
  1461. * Deprecated:
  1462. * Folder Manager routing is deprecated on Mac OS X. Do not rely on
  1463. * this feature in your application, because support for it will be
  1464. * removed in a future version of the OS.
  1465. *
  1466. * Summary:
  1467. * Obtains folder routing information from the global routing list.
  1468. *
  1469. * Discussion:
  1470. * The folder routing information in the global routing list
  1471. * determines how the Finder routes files.
  1472. *
  1473. * Mac OS X threading:
  1474. * Thread safe since version 10.3
  1475. *
  1476. * Parameters:
  1477. *
  1478. * requestedRoutingCount:
  1479. * An unsigned 32-bit value. Pass the number of folder routing
  1480. * structures that can fit in the buffer pointed to by the
  1481. * theRoutings parameter.
  1482. *
  1483. * totalRoutingCount:
  1484. * A pointer to an unsigned 32-bit value. On return, the value is
  1485. * set to the number of folder routing structures in the global
  1486. * list. If this value is less than or equal to
  1487. * requestedRoutingCount , all folder routing structures were
  1488. * returned to the caller.
  1489. *
  1490. * routingSize:
  1491. * Pass the size (in bytes) of the FolderRouting structure.
  1492. *
  1493. * theRoutings:
  1494. * Pass a pointer to an array of FolderRouting structures. On
  1495. * return the structure(s) contain the requested routing
  1496. * information. You may pass null if you do not wish this
  1497. * information.
  1498. *
  1499. * Availability:
  1500. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  1501. * CarbonLib: in CarbonLib 1.0 and later
  1502. * Non-Carbon CFM: in FoldersLib 1.0 and later
  1503. }
  1504. function GetFolderRoutings( requestedRoutingCount: UInt32; var totalRoutingCount: UInt32; routingSize: Size; var theRoutings: FolderRouting ): OSErr; external name '_GetFolderRoutings';
  1505. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  1506. {
  1507. * FSpDetermineIfSpecIsEnclosedByFolder() *** DEPRECATED ***
  1508. *
  1509. * Deprecated:
  1510. * Use FSDetemineIfRefIsEnclosedByFolder
  1511. *
  1512. * Summary:
  1513. * Determine whether the given FSSpec is enclosed inside the given
  1514. * special folder type for the given domain.
  1515. *
  1516. * Discussion:
  1517. * This is a fairly fast call which can determine whether a given
  1518. * FSSpec on disk is 'inside' the given special folder type for the
  1519. * given domain. This call will be more efficient than the
  1520. * equivalent client code which walked up the file list, checking
  1521. * each parent with IdentifyFolder() to see if it matches. One use
  1522. * for this call is to determine if a given file or folder is inside
  1523. * the trash on a volume, with something like
  1524. *
  1525. * err = FSpDetermineIfRefIsEnclosedByFolder( kOnAppropriateDisk,
  1526. * kTrashFolderType, & spec, & result );
  1527. * if ( err == noErr && result ) (
  1528. * // FSSpec is inside trash on the volume.<br> )
  1529. *
  1530. * Mac OS X threading:
  1531. * Thread safe since version 10.4
  1532. *
  1533. * Parameters:
  1534. *
  1535. * domainOrVRefNum:
  1536. * The domain or vRefNum to check. You can also pass
  1537. * kOnAppropriateDisk to check whatever vRefNum is appropriate for
  1538. * the given FSSpec, or the value 0 to check all vRefNums and
  1539. * domains.
  1540. *
  1541. * folderType:
  1542. * The folder type to check
  1543. *
  1544. * inSpec:
  1545. * The FSSpec to look for.
  1546. *
  1547. * outResult:
  1548. * If non-NULL, this will be filled in with true if the given
  1549. * FSSpec is enclosed inside the special folder type for the given
  1550. * domain, or false otherwise.
  1551. *
  1552. * Availability:
  1553. * Mac OS X: in version 10.4 and later in CoreServices.framework [32-bit only] but deprecated in 10.5
  1554. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  1555. * Non-Carbon CFM: not available
  1556. }
  1557. function FSpDetermineIfSpecIsEnclosedByFolder( domainOrVRefNum: FSVolumeRefNum; folderType: OSType; const (*var*) inSpec: FSSpec; var outResult: Boolean ): OSErr; external name '_FSpDetermineIfSpecIsEnclosedByFolder';
  1558. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_5, __IPHONE_NA, __IPHONE_NA) *)
  1559. {$endc} {not TARGET_CPU_64}
  1560. type
  1561. FolderManagerNotificationProcPtr = function( message: OSType; arg: UnivPtr; userRefCon: UnivPtr ): OSStatus;
  1562. FolderManagerNotificationUPP = FolderManagerNotificationProcPtr;
  1563. {
  1564. * NewFolderManagerNotificationUPP()
  1565. *
  1566. * Availability:
  1567. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1568. * CarbonLib: in CarbonLib 1.0.2 and later
  1569. * Non-Carbon CFM: available as macro/inline
  1570. }
  1571. function NewFolderManagerNotificationUPP( userRoutine: FolderManagerNotificationProcPtr ): FolderManagerNotificationUPP; external name '_NewFolderManagerNotificationUPP';
  1572. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1573. {
  1574. * DisposeFolderManagerNotificationUPP()
  1575. *
  1576. * Availability:
  1577. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1578. * CarbonLib: in CarbonLib 1.0.2 and later
  1579. * Non-Carbon CFM: available as macro/inline
  1580. }
  1581. procedure DisposeFolderManagerNotificationUPP( userUPP: FolderManagerNotificationUPP ); external name '_DisposeFolderManagerNotificationUPP';
  1582. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1583. {
  1584. * InvokeFolderManagerNotificationUPP()
  1585. *
  1586. * Availability:
  1587. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1588. * CarbonLib: in CarbonLib 1.0.2 and later
  1589. * Non-Carbon CFM: available as macro/inline
  1590. }
  1591. function InvokeFolderManagerNotificationUPP( message: OSType; arg: UnivPtr; userRefCon: UnivPtr; userUPP: FolderManagerNotificationUPP ): OSStatus; external name '_InvokeFolderManagerNotificationUPP';
  1592. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1593. {$ifc not TARGET_CPU_64}
  1594. {
  1595. * FolderManagerRegisterNotificationProc() *** DEPRECATED ***
  1596. *
  1597. * Deprecated:
  1598. * This function is deprecated on Mac OS X.
  1599. *
  1600. * Summary:
  1601. * Register a function to be called at certain times
  1602. *
  1603. * Mac OS X threading:
  1604. * Not thread safe
  1605. *
  1606. * Parameters:
  1607. *
  1608. * notificationProc:
  1609. *
  1610. * refCon:
  1611. *
  1612. * options:
  1613. *
  1614. * Availability:
  1615. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
  1616. * CarbonLib: in CarbonLib 1.0 and later
  1617. * Non-Carbon CFM: in InterfaceLib 9.0 and later
  1618. }
  1619. function FolderManagerRegisterNotificationProc( notificationProc: FolderManagerNotificationUPP; refCon: UnivPtr; options: UInt32 ): OSErr; external name '_FolderManagerRegisterNotificationProc';
  1620. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
  1621. {
  1622. * FolderManagerUnregisterNotificationProc() *** DEPRECATED ***
  1623. *
  1624. * Deprecated:
  1625. * This function is deprecated on Mac OS X.
  1626. *
  1627. * Summary:
  1628. * Unregister a function to be called at certain times
  1629. *
  1630. * Mac OS X threading:
  1631. * Not thread safe
  1632. *
  1633. * Parameters:
  1634. *
  1635. * notificationProc:
  1636. *
  1637. * refCon:
  1638. *
  1639. * Availability:
  1640. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
  1641. * CarbonLib: in CarbonLib 1.0 and later
  1642. * Non-Carbon CFM: in InterfaceLib 9.0 and later
  1643. }
  1644. function FolderManagerUnregisterNotificationProc( notificationProc: FolderManagerNotificationUPP; refCon: UnivPtr ): OSErr; external name '_FolderManagerUnregisterNotificationProc';
  1645. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
  1646. {
  1647. * FolderManagerRegisterCallNotificationProcs() *** DEPRECATED ***
  1648. *
  1649. * Deprecated:
  1650. * This function is deprecated on Mac OS X.
  1651. *
  1652. * Summary:
  1653. * Call the registered Folder Manager notification procs.
  1654. *
  1655. * Mac OS X threading:
  1656. * Not thread safe
  1657. *
  1658. * Parameters:
  1659. *
  1660. * message:
  1661. *
  1662. * arg:
  1663. *
  1664. * options:
  1665. *
  1666. * Availability:
  1667. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
  1668. * CarbonLib: in CarbonLib 1.0 and later
  1669. * Non-Carbon CFM: in InterfaceLib 9.0 and later
  1670. }
  1671. function FolderManagerRegisterCallNotificationProcs( message: OSType; arg: UnivPtr; options: UInt32 ): OSStatus; external name '_FolderManagerRegisterCallNotificationProcs';
  1672. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
  1673. {$endc} {not TARGET_CPU_64}
  1674. {$endc} {TARGET_OS_MAC}
  1675. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  1676. end.
  1677. {$endc} {not MACOSALLINCLUDE}