iSightを使ってBooklog,MediaMarkerインポート用CSVファイルを生成するアプリ
Revision | f648e108a0fc86621367e2702144175f2fe0a707 (tree) |
---|---|
Time | 2011-06-01 21:39:47 |
Author | masakih <masakih@user...> |
Commiter | masakih |
[New] エクスポートファイルの最後にNewLineを追加出来るようにした。
@@ -41,5 +41,6 @@ NSString *tagsString(NSArray *tags); | ||
41 | 41 | - (NSString *)lineForBook:(BEBookInformation *)book; |
42 | 42 | - (NSString *)lineSeparator; // default line sparator is CRLF. |
43 | 43 | - (NSStringEncoding)fileEncoding; // default fileEncoding is NSShiftJISStringEncoding. |
44 | +- (BOOL)needsNewLineToEndOfFile; // default is NO. | |
44 | 45 | |
45 | 46 | @end |
@@ -61,6 +61,9 @@ | ||
61 | 61 | |
62 | 62 | NSString *string = [lines componentsJoinedByString:[self lineSeparator]]; |
63 | 63 | [lines release]; lines = nil; |
64 | + if([self needsNewLineToEndOfFile]) { | |
65 | + string = [string stringByAppendingString:[self lineSeparator]]; | |
66 | + } | |
64 | 67 | NSError *error = nil; |
65 | 68 | BOOL isOK = NO; |
66 | 69 | isOK = [string writeToURL:url atomically:YES encoding:[self fileEncoding] error:&error]; |
@@ -109,5 +112,6 @@ NSString *normalizeString(NSString *string) | ||
109 | 112 | - (NSString *)lineForBook:(BEBookInformation *)book { return nil; } |
110 | 113 | - (NSString *)lineSeparator { return @"\r\n"; } |
111 | 114 | - (NSStringEncoding)fileEncoding { return NSShiftJISStringEncoding; } |
115 | +- (BOOL)needsNewLineToEndOfFile { return NO; } | |
112 | 116 | |
113 | 117 | @end |