2 * Copyright (c) 1999-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Portions Copyright (c) 1999-2000 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.1 (the "License"). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
14 * The Original Code and all software distributed under the License are
15 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
22 * @APPLE_LICENSE_HEADER_END@
26 This API returns the various standard system directories where apps, resources, etc get installed.
27 Because queries can return multiple directories, the API is in the form of an enumeration.
28 The directories are returned in search path order; that is, the first place to look is returned first.
29 This API may return directories that do not exist yet.
30 If NSUserDomain is included in a query, then the results will contain "~" to refer to the user's directory.
31 NEXT_ROOT is prepended as necessary to the returned values.
32 Some calls might return no directories!
33 The buffer that is passed in will be filled with a null-terminated string, possibly containing as many as PATH_MAX-1 characters.
38 #include <NSSystemDirectories.h>
41 NSSearchPathEnumerationState state = NSStartSearchPathEnumeration(dir, domainMask);
42 while (state = NSGetNextSearchPathEnumeration(state, path)) {
49 #ifndef __NS_SYSTEM_DIRECTORIES_H__
50 #define __NS_SYSTEM_DIRECTORIES_H__
55 NSApplicationDirectory
= 1, // supported applications (Applications)
56 NSDemoApplicationDirectory
, // unsupported applications, demonstration versions (Applications/GrabBag)
57 NSDeveloperApplicationDirectory
, // developer applications (Developer/Applications)
58 NSAdminApplicationDirectory
, // system and network administration applications (Applications/Utilities)
59 NSLibraryDirectory
, // various user-visible documentation, support, and configuration files, resources (Library)
60 NSDeveloperDirectory
, // developer resources (Developer)
61 NSUserDirectory
, // user home directories (Users)
62 NSDocumentationDirectory
, // documentation (Library/Documentation)
63 NSAllApplicationsDirectory
= 100, // all directories where applications can occur (Applications, Applications/Utilities, Developer/Applications, Applications/GrabBag)
64 NSAllLibrariesDirectory
= 101 // all directories where resources can occur (Library, Developer)
65 } NSSearchPathDirectory
;
70 NSUserDomainMask
= 1, // user's home directory --- place to install user's personal items (~)
71 NSLocalDomainMask
= 2, // local to the current machine --- place to install items available to everyone on this machine
72 NSNetworkDomainMask
= 4, // publically available location in the local area network --- place to install items available on the network (/Network)
73 NSSystemDomainMask
= 8, // provided by Apple
74 NSAllDomainsMask
= 0x0ffff // all domains: all of the above and more, future items
75 } NSSearchPathDomainMask
;
77 typedef unsigned int NSSearchPathEnumerationState
;
80 Call NSStartSearchPathEnumeration() once, then call NSGetNextSearchPathEnumeration() one or more times with the returned state.
81 The return value of NSGetNextSearchPathEnumeration() should be used as the state next time around.
82 When NSGetNextSearchPathEnumeration() returns 0, you're done.
84 extern NSSearchPathEnumerationState
NSStartSearchPathEnumeration(NSSearchPathDirectory dir
, NSSearchPathDomainMask domainMask
);
86 extern NSSearchPathEnumerationState
NSGetNextSearchPathEnumeration(NSSearchPathEnumerationState state
, char *path
);
88 #endif /* __NS_SYSTEM_DIRECTORIES_H__ */