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