]> err.no Git - sope/blob - libFoundation/Foundation/NSPathUtilities.h
fixed some NGMail framework build issue
[sope] / libFoundation / Foundation / NSPathUtilities.h
1 /* 
2    NSPathUtilities.h
3
4    Copyright (C) 1995, 1996 Ovidiu Predescu and Mircea Oancea.
5    All rights reserved.
6
7    Author: Mircea Oancea <mircea@jupiter.elcom.pub.ro>
8
9    This file is part of libFoundation.
10
11    Permission to use, copy, modify, and distribute this software and its
12    documentation for any purpose and without fee is hereby granted, provided
13    that the above copyright notice appear in all copies and that both that
14    copyright notice and this permission notice appear in supporting
15    documentation.
16
17    We disclaim all warranties with regard to this software, including all
18    implied warranties of merchantability and fitness, in no event shall
19    we be liable for any special, indirect or consequential damages or any
20    damages whatsoever resulting from loss of use, data or profits, whether in
21    an action of contract, negligence or other tortious action, arising out of
22    or in connection with the use or performance of this software.
23 */
24
25 #ifndef __NSPathUtilities_h__
26 #define __NSPathUtilities_h__
27
28 #include <Foundation/NSString.h>
29
30 /*
31  * User Informations
32  */
33
34 LF_EXPORT NSString *NSUserName(void);
35 LF_EXPORT NSString *NSHomeDirectory(void);
36 LF_EXPORT NSString *NSHomeDirectoryForUser(NSString* userName);
37
38 LF_EXPORT NSString *NSFullUserName();
39 LF_EXPORT NSString *NSTemporaryDirectory();
40
41 /*
42  * Standard System Paths, primarily useful in the GNUstep environment
43  */
44
45 typedef enum {
46     NSUserDomainMask    = 1,
47     NSLocalDomainMask   = 2,
48     NSNetworkDomainMask = 4,
49     NSSystemDomainMask  = 8,
50     NSAllDomainsMask    = 255
51 } NSSearchPathDomainMask;
52
53 typedef enum {
54     NSApplicationDirectory = 1,
55     NSLibraryDirectory,
56     NSUserDirectory,
57     NSAllApplicationDirectory = 1000,
58     NSAllLibrariesDirectory
59 } NSSearchPathDirectory;
60
61 @class NSString, NSArray;
62
63 LF_EXPORT NSString *NSOpenStepRootDirectory(void);
64 LF_EXPORT NSArray  *NSStandardLibraryPaths(void);
65 LF_EXPORT NSArray  *NSStandardApplicationPaths(void);
66
67 LF_EXPORT NSArray *
68 NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory _directory,
69                                     NSSearchPathDomainMask _mask,
70                                     BOOL _expandTilde);
71
72 /*
73  * String file naming utilities
74  */
75
76 @interface NSString(FilePathMethods)
77
78 + (NSString *)pathWithComponents:(NSArray *)components;
79 - (NSArray *)pathComponents;
80 - (unsigned int)completePathIntoString:(NSString **)outputName
81   caseSensitive:(BOOL)flag matchesIntoArray:(NSArray **)outputArray
82   filterTypes:(NSArray*)filterTypes; 
83 - (const char *)fileSystemRepresentation;
84 - (BOOL)getFileSystemRepresentation:(char *)buffer
85   maxLength:(unsigned int)maxLength;
86 - (BOOL)isAbsolutePath;
87 - (NSString *)lastPathComponent;
88 - (NSString *)pathExtension;
89 - (NSString *)stringByAbbreviatingWithTildeInPath;
90 - (NSString *)stringByAppendingPathComponent:(NSString *)aString;
91 - (NSString *)stringByAppendingPathExtension:(NSString *)aString;
92 - (NSString *)stringByDeletingLastPathComponent;
93 - (NSString *)stringByDeletingPathExtension;
94 - (NSString *)stringByExpandingTildeInPath;
95 - (NSString *)stringByResolvingSymlinksInPath;
96 - (NSString *)stringByStandardizingPath;
97 - (NSArray *)stringsByAppendingPaths:(NSArray *)paths;
98
99 @end
100
101 #endif /* __NSPathUtilities_h__ */
102
103 #ifndef __NSPathUtilitiesArray_h__
104 #define __NSPathUtilitiesArray_h__
105
106 #include <Foundation/NSArray.h>
107
108 @interface NSArray(FilePathMethods)
109
110 - (NSArray *)pathsMatchingExtensions:(NSArray *)_exts; /* new in MacOSX */
111
112 @end
113
114 #endif /* __NSPathUtilitiesArray_h__ */
115
116 /*
117   Local Variables:
118   c-basic-offset: 4
119   tab-width: 8
120   End:
121 */