2007-03-14 02:29:16 +00:00
|
|
|
//
|
|
|
|
// NSFileHandle+CreateFile.m
|
|
|
|
// Cog
|
|
|
|
//
|
|
|
|
// Created by Zaphod Beeblebrox on 3/13/07.
|
|
|
|
// Copyright 2007 __MyCompanyName__. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "NSFileHandle+CreateFile.h"
|
|
|
|
|
|
|
|
@implementation NSFileHandle (CreateFile)
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
+ (id)fileHandleForWritingAtPath:(NSString *)path createFile:(BOOL)create {
|
2007-03-14 02:29:16 +00:00
|
|
|
NSFileManager *manager = [NSFileManager defaultManager];
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
if(![manager fileExistsAtPath:path])
|
2007-03-14 02:29:16 +00:00
|
|
|
[manager createFileAtPath:path contents:nil attributes:nil];
|
2022-02-07 05:49:27 +00:00
|
|
|
|
2007-03-14 02:29:16 +00:00
|
|
|
return [NSFileHandle fileHandleForWritingAtPath:path];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|