ObjFW
|
00001 /* 00002 * Copyright (c) 2008, 2009, 2010, 2011 00003 * Jonathan Schleifer <js@webkeks.org> 00004 * 00005 * All rights reserved. 00006 * 00007 * This file is part of ObjFW. It may be distributed under the terms of the 00008 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in 00009 * the packaging of this file. 00010 * 00011 * Alternatively, it may be distributed under the terms of the GNU General 00012 * Public License, either version 2 or 3, which can be found in the file 00013 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this 00014 * file. 00015 */ 00016 00017 #include <sys/types.h> 00018 00019 #import "OFSeekableStream.h" 00020 00021 @class OFArray; 00022 @class OFDate; 00023 00024 #ifdef __cplusplus 00025 extern "C" { 00026 #endif 00027 extern void of_log(OFConstantString*, ...); 00028 #ifdef __cplusplus 00029 } 00030 #endif 00031 00035 @interface OFFile: OFSeekableStream 00036 { 00037 int fd; 00038 BOOL closable; 00039 BOOL eos; 00040 } 00041 00047 + fileWithPath: (OFString*)path 00048 mode: (OFString*)mode; 00049 00055 + fileWithFileDescriptor: (int)fd; 00056 00060 + (OFString*)currentDirectoryPath; 00061 00066 + (BOOL)fileExistsAtPath: (OFString*)path; 00067 00072 + (BOOL)directoryExistsAtPath: (OFString*)path; 00073 00079 + (void)createDirectoryAtPath: (OFString*)path; 00080 00085 + (OFArray*)filesInDirectoryAtPath: (OFString*)path; 00086 00092 + (void)changeToDirectory: (OFString*)path; 00093 00097 + (OFDate*)modificationDateOfFile: (OFString*)path; 00098 00099 #ifndef _PSP 00100 00109 + (void)changeModeOfFile: (OFString*)path 00110 toMode: (mode_t)mode; 00111 #endif 00112 00113 #if !defined(_WIN32) && !defined(_PSP) 00114 00124 + (void)changeOwnerOfFile: (OFString*)path 00125 toOwner: (OFString*)owner 00126 group: (OFString*)group; 00127 #endif 00128 00135 + (void)copyFileAtPath: (OFString*)from 00136 toPath: (OFString*)to; 00137 00144 + (void)renameFileAtPath: (OFString*)from 00145 toPath: (OFString*)to; 00146 00152 + (void)deleteFileAtPath: (OFString*)path; 00153 00159 + (void)deleteDirectoryAtPath: (OFString*)path; 00160 00161 #ifndef _WIN32 00162 00170 + (void)linkFileAtPath: (OFString*)src 00171 toPath: (OFString*)dest; 00172 #endif 00173 00174 #if !defined(_WIN32) && !defined(_PSP) 00175 00183 + (void)symlinkFileAtPath: (OFString*)src 00184 toPath: (OFString*)dest; 00185 #endif 00186 00194 - initWithPath: (OFString*)path 00195 mode: (OFString*)mode; 00196 00203 - initWithFileDescriptor: (int)fd; 00204 @end 00205 00206 #ifdef __cplusplus 00207 extern "C" { 00208 #endif 00209 extern OFFile *of_stdin; 00210 extern OFFile *of_stdout; 00211 extern OFFile *of_stderr; 00212 #ifdef __cplusplus 00213 } 00214 #endif