ObjFW  Check-in [5f222e25a7]

Overview
Comment:Better names for a few file operations.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5f222e25a78cdeb43156a89fb6cf5db88c718b55f84becee0342220424f02ca4
User & Date: js on 2010-04-11 20:41:29
Other Links: manifest | tags
Context
2010-04-15
08:11
Add +[directoryExistsAtPath:] and +[filesInDirectoryAtPath:] to OFFile. check-in: 8d84aa00aa user: js tags: trunk
2010-04-11
20:41
Better names for a few file operations. check-in: 5f222e25a7 user: js tags: trunk
20:12
Add +[fileExistsAtPath:] to OFFile. check-in: ebd1fc0d9a user: js tags: trunk
Changes

Modified src/OFFile.h from [5e6541f4e0] to [f110a6ebca].

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

/**
 * Renames a file.
 *
 * \param from The file to rename
 * \param to The new name
 */
+ (void)rename: (OFString*)from
	    to: (OFString*)to;

/**
 * Deletes a file.
 *
 * \param path The path to the file of which should be deleted as a string
 */
+ (void)delete: (OFString*)path;

#ifndef _WIN32
/**
 * Hardlinks a file.
 *
 * Not available on Windows.
 *
 * \param src The path to the file of which should be linked as a string
 * \param dest The path to where the file should be linked as a string
 */
+ (void)link: (OFString*)src
	  to: (OFString*)dest;

/**
 * Symlinks a file.
 *
 * Not available on Windows.
 *
 * \param src The path to the file of which should be symlinked as a string
 * \param dest The path to where the file should be symlinked as a string
 */
+ (void)symlink: (OFString*)src
	     to: (OFString*)dest;
#endif

/**
 * Initializes an already allocated OFFile.
 *
 * \param path The path to the file to open as a string
 * \param mode The mode in which the file should be opened as a string







|
|






|










|
|









|
|







75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

/**
 * Renames a file.
 *
 * \param from The file to rename
 * \param to The new name
 */
+ (void)renameFileWithPath: (OFString*)from
		    toPath: (OFString*)to;

/**
 * Deletes a file.
 *
 * \param path The path to the file of which should be deleted as a string
 */
+ (void)deleteFileWithPath: (OFString*)path;

#ifndef _WIN32
/**
 * Hardlinks a file.
 *
 * Not available on Windows.
 *
 * \param src The path to the file of which should be linked as a string
 * \param dest The path to where the file should be linked as a string
 */
+ (void)linkFileWithPath: (OFString*)src
		  toPath: (OFString*)dest;

/**
 * Symlinks a file.
 *
 * Not available on Windows.
 *
 * \param src The path to the file of which should be symlinked as a string
 * \param dest The path to where the file should be symlinked as a string
 */
+ (void)symlinkFileWithPath: (OFString*)src
		     toPath: (OFString*)dest;
#endif

/**
 * Initializes an already allocated OFFile.
 *
 * \param path The path to the file to open as a string
 * \param mode The mode in which the file should be opened as a string

Modified src/OFFile.m from [c32b62d50c] to [193ba08435].

152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
		@throw [OFChangeFileOwnerFailedException newWithClass: self
								 path: path
								owner: owner
								group: group];
}
#endif

+ (void)rename: (OFString*)from
	    to: (OFString*)to
{
#ifndef _WIN32
	if (rename([from cString], [to cString]))
#else
	if (!MoveFile([from cString], [to cString]))
#endif
		@throw [OFRenameFileFailedException newWithClass: self
							    from: from
							      to: to];
}

+ (void)delete: (OFString*)path
{
#ifndef _WIN32
	if (unlink([path cString]))
#else
	if (!DeleteFile([path cString]))
#endif
		@throw [OFDeleteFileFailedException newWithClass: self
							    path: path];
}

#ifndef _WIN32
+ (void)link: (OFString*)src
	  to: (OFString*)dest
{
	if (link([src cString], [dest cString]) != 0)
		@throw [OFLinkFailedException newWithClass: self
						    source: src
					       destination: dest];
}

+ (void)symlink: (OFString*)src
	     to: (OFString*)dest
{
	if (symlink([src cString], [dest cString]) != 0)
		@throw [OFSymlinkFailedException newWithClass: self
						       source: src
						  destination: dest];
}
#endif







|
|











|











|
|







|
|







152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
		@throw [OFChangeFileOwnerFailedException newWithClass: self
								 path: path
								owner: owner
								group: group];
}
#endif

+ (void)renameFileWithPath: (OFString*)from
		    toPath: (OFString*)to
{
#ifndef _WIN32
	if (rename([from cString], [to cString]))
#else
	if (!MoveFile([from cString], [to cString]))
#endif
		@throw [OFRenameFileFailedException newWithClass: self
							    from: from
							      to: to];
}

+ (void)deleteFileWithPath: (OFString*)path
{
#ifndef _WIN32
	if (unlink([path cString]))
#else
	if (!DeleteFile([path cString]))
#endif
		@throw [OFDeleteFileFailedException newWithClass: self
							    path: path];
}

#ifndef _WIN32
+ (void)linkFileWithPath: (OFString*)src
		  toPath: (OFString*)dest
{
	if (link([src cString], [dest cString]) != 0)
		@throw [OFLinkFailedException newWithClass: self
						    source: src
					       destination: dest];
}

+ (void)symlinkFileWithPath: (OFString*)src
		     toPath: (OFString*)dest
{
	if (symlink([src cString], [dest cString]) != 0)
		@throw [OFSymlinkFailedException newWithClass: self
						       source: src
						  destination: dest];
}
#endif