swfから画像を抽出するコマンドラインアプリケーション
Revisión | a45cb889232691051f3e7c7b08bc04943fac512d (tree) |
---|---|
Tiempo | 2017-08-06 16:23:30 |
Autor | masakih <masakih@user...> |
Commiter | masakih |
パス名の取得に失敗する問題を修正
@@ -478,11 +478,15 @@ int main(int argc, char * const *argv) { | ||
478 | 478 | } |
479 | 479 | |
480 | 480 | if(oFilename) { |
481 | - outputDir = [NSString stringWithFormat:@"%s", oFilename]; | |
481 | + outputDir = [[NSString alloc] initWithUTF8String:oFilename]; | |
482 | + if( outputDir.length == 0 ) { | |
483 | + fprintf(stderr, "Output directory:%s can not convert file represendation.\n", oFilename); | |
484 | + exit(EXIT_FAILURE); | |
485 | + } | |
482 | 486 | NSFileManager *fm = [NSFileManager defaultManager]; |
483 | 487 | BOOL isDir = NO; |
484 | 488 | if(![fm fileExistsAtPath:outputDir isDirectory:&isDir] || !isDir) { |
485 | - fprintf(stderr, "Output directory:%s is not found or not directory.", outputDir.fileSystemRepresentation); | |
489 | + fprintf(stderr, "Output directory:%s is not found or not directory.\n", outputDir.UTF8String); | |
486 | 490 | exit(EXIT_FAILURE); |
487 | 491 | } |
488 | 492 | } else { |
@@ -491,7 +495,7 @@ int main(int argc, char * const *argv) { | ||
491 | 495 | } |
492 | 496 | |
493 | 497 | if(charactorid) { |
494 | - NSString *charactoridsString = [NSString stringWithFormat:@"%s", charactorid]; | |
498 | + NSString *charactoridsString = [[NSString alloc] initWithUTF8String:charactorid]; | |
495 | 499 | NSArray *ids = [charactoridsString componentsSeparatedByString:@","]; |
496 | 500 | if(ids.count != 0) { |
497 | 501 | charactorIds = ids; |
@@ -507,7 +511,7 @@ int main(int argc, char * const *argv) { | ||
507 | 511 | Information *info = [Information new]; |
508 | 512 | info.outputDir = outputDir; |
509 | 513 | info.charctorIds = charactorIds; |
510 | - info.filename = [NSString stringWithFormat:@"%s", filename]; | |
514 | + info.filename = [[NSString alloc] initWithUTF8String:filename]; | |
511 | 515 | |
512 | 516 | dispatch_group_async(group, queue, ^{ |
513 | 517 | extractImagesFromSWFFile(info); |