2002-12-31 11:29:59 +00:00
|
|
|
/** Interface to file path utilities for GNUStep
|
1996-05-28 21:25:46 +00:00
|
|
|
Copyright (C) 1996 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
|
|
|
Created: May 1996
|
|
|
|
|
|
|
|
This file is part of the GNUstep Base Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with this library; if not, write to the Free
|
2006-02-19 21:49:21 +00:00
|
|
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02111 USA.
|
2002-02-13 19:48:24 +00:00
|
|
|
|
2005-03-03 16:04:22 +00:00
|
|
|
AutogsdocSource: NSPathUtilities.m
|
1996-05-28 21:25:46 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __NSPathUtilities_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
#define __NSPathUtilities_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
|
|
|
|
#include <Foundation/NSString.h>
|
|
|
|
|
1999-02-20 21:19:15 +00:00
|
|
|
#ifndef NO_GNUSTEP
|
2006-02-19 21:49:21 +00:00
|
|
|
@class NSDictionary;
|
|
|
|
@class NSMutableDictionary;
|
2002-10-09 11:30:37 +00:00
|
|
|
/**
|
1999-02-20 21:19:15 +00:00
|
|
|
* This extension permits a change of username from that specified in the
|
|
|
|
* LOGNAME environment variable. Using it will almost certainly cause
|
2005-11-06 13:53:40 +00:00
|
|
|
* trouble if the process does not posses the file access privileges of the
|
1999-02-20 21:19:15 +00:00
|
|
|
* new name. This is provided primarily for use by processes that run as
|
2005-03-03 16:04:22 +00:00
|
|
|
* system-manager and need to act as particular users. It uses the
|
1999-02-20 21:19:15 +00:00
|
|
|
* [NSUserDefaults +resetUserDefaults] extension to reset the defaults system
|
|
|
|
* to use the defaults belonging to the new user.
|
|
|
|
*/
|
2006-02-19 21:49:21 +00:00
|
|
|
GS_EXPORT void
|
|
|
|
GSSetUserName(NSString *aName);
|
2005-03-03 16:04:22 +00:00
|
|
|
|
2006-02-19 21:49:21 +00:00
|
|
|
/**
|
|
|
|
* Returns a mutable copy of the system-wide configuration used to
|
|
|
|
* determine paths to locate files etc.<br />
|
|
|
|
* If the newConfig argument is non-nil it is used to set the config
|
|
|
|
* overriding any other version. You should not change the config
|
|
|
|
* after the user defaults system has been initialised as the new
|
2006-02-22 07:39:34 +00:00
|
|
|
* config will not be picked up by the defaults system.<br />
|
|
|
|
* <br />
|
|
|
|
* A typical sequence of operation might be to<br />
|
|
|
|
* Call the function with a nil argument to obtain the configuration
|
|
|
|
* information currently in use (usually obtained from the main GNUstep
|
|
|
|
* configuration file).<br />
|
|
|
|
* Modify the dictionary contents.<br />
|
|
|
|
* Call the function again passing back in the modified config.<br />
|
|
|
|
* <br />
|
|
|
|
* If you call this function with a non-nil argument before the system
|
|
|
|
* configuration file has been read, you will prevent the file from
|
|
|
|
* being read. However, you must take care doing this that creation
|
|
|
|
* of the config dictionary you are going to pass in to the function
|
|
|
|
* does not have any side-effects which would cause the config file
|
|
|
|
* to be read earlier.<br />
|
|
|
|
* If you want to prevent the user specific config file from being
|
|
|
|
* read, you must set the GNUSTEP_USER_CONFIG_FILE value in the
|
|
|
|
* dictionary to be an empty string.
|
2006-02-19 21:49:21 +00:00
|
|
|
*/
|
|
|
|
GS_EXPORT NSMutableDictionary*
|
|
|
|
GNUstepConfig(NSDictionary *newConfig);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the location of the defaults database for the specified user.
|
2006-02-22 07:39:34 +00:00
|
|
|
* This uses the same information you get from GNUstepConfig() and
|
|
|
|
* GNUstepUserConfig() and builds the path to the defaults database
|
|
|
|
* fromm it.
|
2006-02-19 21:49:21 +00:00
|
|
|
*/
|
|
|
|
GS_EXPORT NSString*
|
2006-02-21 07:51:17 +00:00
|
|
|
GSDefaultsRootForUser(NSString *username);
|
2006-02-19 21:49:21 +00:00
|
|
|
|
|
|
|
/**
|
2006-02-22 07:39:34 +00:00
|
|
|
* The config dictionary passed to this function should be a
|
|
|
|
* system-wide config as provided by GNUstepConfig() ... and
|
2006-02-19 21:49:21 +00:00
|
|
|
* this function merges in user specific configuration file
|
2006-02-22 07:39:34 +00:00
|
|
|
* information if such a file exists and is owned by the user.<br />
|
|
|
|
* NB. If the GNUSTEP_USER_CONFIG_FILE value in the system-wide
|
|
|
|
* config is an empty string, no user-specifc config will be
|
|
|
|
* read.
|
2006-02-19 21:49:21 +00:00
|
|
|
*/
|
|
|
|
GS_EXPORT void
|
|
|
|
GNUstepUserConfig(NSMutableDictionary *config, NSString *userName);
|
2005-03-03 16:04:22 +00:00
|
|
|
|
1999-02-20 21:19:15 +00:00
|
|
|
#endif
|
2002-11-09 06:45:31 +00:00
|
|
|
GS_EXPORT NSString *NSUserName(void);
|
|
|
|
GS_EXPORT NSString *NSHomeDirectory(void);
|
2002-12-31 19:47:26 +00:00
|
|
|
GS_EXPORT NSString *NSHomeDirectoryForUser(NSString *loginName);
|
1998-12-15 19:11:58 +00:00
|
|
|
|
|
|
|
#ifndef STRICT_OPENSTEP
|
2004-07-29 15:30:47 +00:00
|
|
|
/**
|
|
|
|
* Enumeration of possible requested directory type specifiers for
|
|
|
|
* NSSearchPathForDirectoriesInDomains() function. These correspond to the
|
|
|
|
* subdirectories that may be found under, e.g., $GNUSTEP_SYSTEM_ROOT, such
|
|
|
|
* as "Library" and "Applications".
|
|
|
|
<example>
|
|
|
|
{
|
|
|
|
NSApplicationDirectory,
|
|
|
|
NSDemoApplicationDirectory,
|
|
|
|
NSDeveloperApplicationDirectory,
|
|
|
|
NSAdminApplicationDirectory,
|
|
|
|
NSLibraryDirectory,
|
|
|
|
NSDeveloperDirectory,
|
|
|
|
NSUserDirectory,
|
|
|
|
NSDocumentationDirectory,
|
|
|
|
NSAllApplicationsDirectory,
|
|
|
|
NSAllLibrariesDirectory,
|
|
|
|
GSLibrariesDirectory,
|
|
|
|
GSToolsDirectory,
|
|
|
|
GSApplicationSupportDirectory
|
|
|
|
}
|
|
|
|
</example>
|
|
|
|
*/
|
2000-03-25 10:59:07 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
NSApplicationDirectory,
|
|
|
|
NSDemoApplicationDirectory,
|
|
|
|
NSDeveloperApplicationDirectory,
|
|
|
|
NSAdminApplicationDirectory,
|
|
|
|
NSLibraryDirectory,
|
|
|
|
NSDeveloperDirectory,
|
|
|
|
NSUserDirectory,
|
|
|
|
NSDocumentationDirectory,
|
2005-03-03 16:04:22 +00:00
|
|
|
|
|
|
|
/* Apple Reserved Directory Identifiers */
|
|
|
|
|
2000-03-25 10:59:07 +00:00
|
|
|
NSAllApplicationsDirectory,
|
2001-01-28 12:16:44 +00:00
|
|
|
NSAllLibrariesDirectory,
|
2005-03-03 16:04:22 +00:00
|
|
|
|
|
|
|
/* GNUstep Directory Identifiers */
|
|
|
|
|
|
|
|
//GSApplicationSupportDirectory = 150,
|
|
|
|
//GSFontsDirectory,
|
|
|
|
//GSFrameworksDirectory,
|
2001-01-28 12:16:44 +00:00
|
|
|
GSLibrariesDirectory,
|
2001-08-01 10:59:58 +00:00
|
|
|
GSToolsDirectory,
|
2003-05-14 14:52:58 +00:00
|
|
|
GSApplicationSupportDirectory,
|
2005-03-15 04:24:26 +00:00
|
|
|
GSPreferencesDirectory,
|
2005-03-03 16:04:22 +00:00
|
|
|
|
2005-03-15 04:24:26 +00:00
|
|
|
GSFontsDirectory,
|
|
|
|
GSFrameworksDirectory
|
2005-03-03 16:04:22 +00:00
|
|
|
} NSSearchPathDirectory;
|
2000-03-25 10:59:07 +00:00
|
|
|
|
2004-07-29 15:30:47 +00:00
|
|
|
/**
|
|
|
|
* Mask type for NSSearchPathForDirectoriesInDomains() function. A bitwise OR
|
|
|
|
* of one or more of <code>NSUserDomainMask, NSLocalDomainMask,
|
|
|
|
* NSNetworkDomainMask, NSSystemDomainMask, NSAllDomainsMask</code>.
|
|
|
|
*/
|
2005-03-03 16:04:22 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
NSUserDomainMask = 1,
|
|
|
|
NSLocalDomainMask = 2,
|
|
|
|
NSNetworkDomainMask = 4,
|
|
|
|
NSSystemDomainMask = 8,
|
|
|
|
NSAllDomainsMask = 0xffffffff,
|
|
|
|
} NSSearchPathDomainMask;
|
2000-03-25 10:59:07 +00:00
|
|
|
|
2002-12-31 19:47:26 +00:00
|
|
|
GS_EXPORT NSArray *NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directoryKey, NSSearchPathDomainMask domainMask, BOOL expandTilde);
|
2000-06-14 04:03:56 +00:00
|
|
|
GS_EXPORT NSString *NSFullUserName(void);
|
|
|
|
GS_EXPORT NSArray *NSStandardApplicationPaths(void);
|
|
|
|
GS_EXPORT NSArray *NSStandardLibraryPaths(void);
|
|
|
|
GS_EXPORT NSString *NSTemporaryDirectory(void);
|
|
|
|
GS_EXPORT NSString *NSOpenStepRootDirectory(void);
|
1998-12-15 19:11:58 +00:00
|
|
|
#endif /* !STRICT_OPENSTEP */
|
1996-05-28 21:25:46 +00:00
|
|
|
|
|
|
|
#endif /* __NSPathUtilities_h_GNUSTEP_BASE_INCLUDE */
|