forked from akahan/Nib-Decompiler
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
133 additions
and
731 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// NibDecompiler.m | ||
// Nib Decompiler | ||
// | ||
// Created by Roman Yusufkhanov on 06.11.10. | ||
// Copyright (c) 2010 Yukka-S. All rights reserved. | ||
// | ||
|
||
#import "NibDecompiler.h" | ||
|
||
|
||
@implementation NibDecompiler | ||
|
||
- (id)runWithInput:(id)input fromAction:(AMAction *)anAction error:(NSDictionary **)errorInfo | ||
{ | ||
if([input isKindOfClass:[NSArray class]]) | ||
{ | ||
NSFileManager * manager = [NSFileManager defaultManager]; | ||
NSBundle * bundle = [NSBundle bundleForClass:[self class]]; | ||
|
||
for(id itemPath in input) | ||
{ | ||
if([itemPath isKindOfClass:[NSString class]] && [[itemPath pathExtension] isEqualToString:@"nib"]) | ||
{ | ||
if(![[NSWorkspace sharedWorkspace] isFilePackageAtPath:itemPath]) | ||
{ | ||
NSString * keyedobjectsPathOld = [NSString stringWithFormat:@"%@/keyedobjects.nib", [itemPath stringByDeletingLastPathComponent]]; | ||
NSString * keyedobjectsPathNew = [NSString stringWithFormat:@"%@/keyedobjects.nib", itemPath]; | ||
[manager moveItemAtPath:itemPath toPath:keyedobjectsPathOld error:NULL]; | ||
[manager createDirectoryAtPath:itemPath withIntermediateDirectories:YES attributes:nil error:NULL]; | ||
[manager moveItemAtPath:keyedobjectsPathOld toPath:keyedobjectsPathNew error:NULL]; | ||
} | ||
|
||
NSString * classesNibPathNew = [NSString stringWithFormat:@"%@/classes.nib", itemPath]; | ||
NSString * infoNibPathNew = [NSString stringWithFormat:@"%@/info.nib", itemPath]; | ||
NSString * classesNibPathOld = [bundle pathForResource:@"classes" ofType:@"nib"]; | ||
NSString * infoNibPathOld = [bundle pathForResource:@"info" ofType:@"nib"]; | ||
|
||
[manager copyItemAtPath:classesNibPathOld toPath:classesNibPathNew error:NULL]; | ||
[manager copyItemAtPath:infoNibPathOld toPath:infoNibPathNew error:NULL]; | ||
} | ||
else | ||
{ | ||
NSLog(@"Class of the item must be NSString (current classname is %@) or file is not nib file",[itemPath className]); | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
NSLog(@"Class of the input must be NSArray (current classname is %@)",[input className]); | ||
} | ||
|
||
return input; | ||
} | ||
|
||
@end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.