Cog/Utils/NSFileHandle+CreateFile.m
Christopher Snowhill 85c7073649 Reformat my own source code with clang-format
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-06 21:49:27 -08:00

22 lines
533 B
Objective-C

//
// 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)
+ (id)fileHandleForWritingAtPath:(NSString *)path createFile:(BOOL)create {
NSFileManager *manager = [NSFileManager defaultManager];
if(![manager fileExistsAtPath:path])
[manager createFileAtPath:path contents:nil attributes:nil];
return [NSFileHandle fileHandleForWritingAtPath:path];
}
@end