]>
Commit | Line | Data |
---|---|---|
e9ce8d39 A |
1 | /* |
2 | * Copyright (c) 1999-2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
734aad71 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
e9ce8d39 A |
12 | * |
13 | * The Original Code and all software distributed under the License are | |
734aad71 | 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
e9ce8d39 A |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
734aad71 A |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
e9ce8d39 A |
20 | * |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
23 | ||
24 | /* | |
25 | This API returns the various standard system directories where apps, resources, etc get installed. | |
26 | Because queries can return multiple directories, the API is in the form of an enumeration. | |
27 | The directories are returned in search path order; that is, the first place to look is returned first. | |
28 | This API may return directories that do not exist yet. | |
29 | If NSUserDomain is included in a query, then the results will contain "~" to refer to the user's directory. | |
30 | NEXT_ROOT is prepended as necessary to the returned values. | |
31 | Some calls might return no directories! | |
32 | The buffer that is passed in will be filled with a null-terminated string, possibly containing as many as PATH_MAX-1 characters. | |
33 | ||
34 | Typical usage: | |
35 | ||
36 | #include <limits.h> | |
37 | #include <NSSystemDirectories.h> | |
38 | ||
39 | char path[PATH_MAX]; | |
40 | NSSearchPathEnumerationState state = NSStartSearchPathEnumeration(dir, domainMask); | |
41 | while (state = NSGetNextSearchPathEnumeration(state, path)) { | |
42 | // Handle path | |
43 | } | |
44 | ||
45 | ||
46 | */ | |
47 | ||
48 | #ifndef __NS_SYSTEM_DIRECTORIES_H__ | |
49 | #define __NS_SYSTEM_DIRECTORIES_H__ | |
50 | ||
9385eb3d A |
51 | #ifdef __cplusplus |
52 | extern "C" { | |
53 | #endif | |
54 | ||
e9ce8d39 A |
55 | // Directories |
56 | ||
57 | typedef enum { | |
3d9156a7 A |
58 | NSApplicationDirectory = 1, // supported applications (Applications) |
59 | NSDemoApplicationDirectory = 2, // unsupported applications, demonstration versions (Applications/GrabBag) | |
60 | NSDeveloperApplicationDirectory = 3, // developer applications (Developer/Applications) | |
61 | NSAdminApplicationDirectory = 4, // system and network administration applications (Applications/Utilities) | |
62 | NSLibraryDirectory = 5, // various user-visible documentation, support, and configuration files, resources (Library) | |
63 | NSDeveloperDirectory = 6, // developer resources (Developer) | |
64 | NSUserDirectory = 7, // user home directories (Users) | |
65 | NSDocumentationDirectory = 8, // documentation (Library/Documentation) | |
66 | NSDocumentDirectory = 9, // documents (Documents) | |
67 | NSCoreServiceDirectory = 10, // location of core services (System/Library/CoreServices) | |
68 | NSDesktopDirectory = 12, // location of user's Desktop (Desktop) | |
69 | NSCachesDirectory = 13, // location of discardable cache files (Library/Caches) | |
70 | NSApplicationSupportDirectory = 14, // location of application support files (plug-ins, etc) (Library/Application Support) | |
71 | NSAllApplicationsDirectory = 100, // all directories where applications can occur (Applications, Applications/Utilities, Developer/Applications, ...) | |
72 | NSAllLibrariesDirectory = 101 // all directories where resources can occur (Library, Developer) | |
e9ce8d39 A |
73 | } NSSearchPathDirectory; |
74 | ||
75 | // Domains | |
76 | ||
77 | typedef enum { | |
78 | NSUserDomainMask = 1, // user's home directory --- place to install user's personal items (~) | |
79 | NSLocalDomainMask = 2, // local to the current machine --- place to install items available to everyone on this machine | |
80 | NSNetworkDomainMask = 4, // publically available location in the local area network --- place to install items available on the network (/Network) | |
81 | NSSystemDomainMask = 8, // provided by Apple | |
82 | NSAllDomainsMask = 0x0ffff // all domains: all of the above and more, future items | |
83 | } NSSearchPathDomainMask; | |
84 | ||
85 | typedef unsigned int NSSearchPathEnumerationState; | |
86 | ||
87 | /* Enumeration | |
88 | Call NSStartSearchPathEnumeration() once, then call NSGetNextSearchPathEnumeration() one or more times with the returned state. | |
89 | The return value of NSGetNextSearchPathEnumeration() should be used as the state next time around. | |
90 | When NSGetNextSearchPathEnumeration() returns 0, you're done. | |
91 | */ | |
9385eb3d | 92 | |
e9ce8d39 A |
93 | extern NSSearchPathEnumerationState NSStartSearchPathEnumeration(NSSearchPathDirectory dir, NSSearchPathDomainMask domainMask); |
94 | ||
95 | extern NSSearchPathEnumerationState NSGetNextSearchPathEnumeration(NSSearchPathEnumerationState state, char *path); | |
96 | ||
9385eb3d A |
97 | #ifdef __cplusplus |
98 | } | |
99 | #endif | |
100 | ||
e9ce8d39 | 101 | #endif /* __NS_SYSTEM_DIRECTORIES_H__ */ |