Skip to content

Commit

Permalink
Инициализация
Browse files Browse the repository at this point in the history
  • Loading branch information
akahan committed Nov 6, 2010
1 parent fee7747 commit 4767e38
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 731 deletions.
56 changes: 56 additions & 0 deletions Classes/NibDecompiler.m
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
18 changes: 0 additions & 18 deletions Classes/Nib_Decompiler.h

This file was deleted.

21 changes: 0 additions & 21 deletions Classes/Nib_Decompiler.m

This file was deleted.

Loading

0 comments on commit 4767e38

Please sign in to comment.