1/*
2 * Copyright (c) 1999-2000, 2009 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
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
51#ifdef __cplusplus
52extern "C" {
53#endif
54
55// Directories
56
57typedef enum {
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    NSAutosavedInformationDirectory = 11,   // location of user's directory for use with autosaving (Library/Autosave Information)
69    NSDesktopDirectory = 12,                // location of user's Desktop (Desktop)
70    NSCachesDirectory = 13,                 // location of discardable cache files (Library/Caches)
71    NSApplicationSupportDirectory = 14,     // location of application support files (plug-ins, etc) (Library/Application Support)
72    NSDownloadsDirectory = 15,              // location of user's Downloads directory (Downloads)
73    NSInputMethodsDirectory = 16,           // input methods (Library/Input Methods)
74    NSMoviesDirectory = 17,                 // location of user's Movies directory (~/Movies)
75    NSMusicDirectory = 18,                  // location of user's Music directory (~/Music)
76    NSPicturesDirectory = 19,               // location of user's Pictures directory (~/Pictures)
77    NSPrinterDescriptionDirectory = 20,     // location of system's PPDs directory (Library/Printers/PPDs)
78    NSSharedPublicDirectory = 21,           // location of user's Public sharing directory (~/Public)
79    NSPreferencePanesDirectory = 22,        // location of the PreferencePanes directory for use with System Preferences (Library/PreferencePanes)
80    NSAllApplicationsDirectory = 100,       // all directories where applications can occur (Applications, Applications/Utilities, Developer/Applications, ...)
81    NSAllLibrariesDirectory = 101           // all directories where resources can occur (Library, Developer)
82} NSSearchPathDirectory;
83
84// Domains
85
86typedef enum {
87   NSUserDomainMask = 1,	// user's home directory --- place to install user's personal items (~)
88   NSLocalDomainMask = 2,	// local to the current machine --- place to install items available to everyone on this machine
89   NSNetworkDomainMask = 4, 	// publically available location in the local area network --- place to install items available on the network (/Network)
90   NSSystemDomainMask = 8,	// provided by Apple
91   NSAllDomainsMask = 0x0ffff	// all domains: all of the above and more, future items
92} NSSearchPathDomainMask;
93
94typedef unsigned int NSSearchPathEnumerationState;
95
96/* Enumeration
97 Call NSStartSearchPathEnumeration() once, then call NSGetNextSearchPathEnumeration() one or more times with the returned state.
98 The return value of NSGetNextSearchPathEnumeration() should be used as the state next time around.
99 When NSGetNextSearchPathEnumeration() returns 0, you're done.
100*/
101
102extern NSSearchPathEnumerationState NSStartSearchPathEnumeration(NSSearchPathDirectory dir, NSSearchPathDomainMask domainMask);
103
104extern NSSearchPathEnumerationState NSGetNextSearchPathEnumeration(NSSearchPathEnumerationState state, char *path);
105
106#ifdef __cplusplus
107}
108#endif
109
110#endif /* __NS_SYSTEM_DIRECTORIES_H__ */
111