Folders.pas 78 KB

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