mirror of
https://github.com/nickshanks/ResKnife.git
synced 2024-10-07 15:58:22 +00:00
d5662e1914
{/Library, ~/Library}/Application Support/ResKnife/Support Resources/ and ResKnife.app/Contents/Resources/Support Resources/
46 lines
1.5 KiB
Objective-C
46 lines
1.5 KiB
Objective-C
//
|
|
// RKSupportResourceRegistry.m
|
|
// ResKnife
|
|
//
|
|
// Created by Uli Kusterer on Mon Aug 18 2003.
|
|
// Copyright (c) 2003 __MyCompanyName__. All rights reserved.
|
|
//
|
|
|
|
#import "RKSupportResourceRegistry.h"
|
|
|
|
|
|
@implementation RKSupportResourceRegistry
|
|
|
|
+(void) scanForSupportResources: (NSDocumentController*)c
|
|
{
|
|
// TODO: Instead of hard-coding sysPath we should use some FindFolder-like API!
|
|
NSString *appSupport = @"Library/Application Support/ResKnife/Support Resources/";
|
|
NSString *appPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Support Resources"];
|
|
NSString *userPath = [NSHomeDirectory() stringByAppendingPathComponent:appSupport];
|
|
NSString *sysPath = [@"/" stringByAppendingPathComponent:appSupport];
|
|
NSArray *paths = [NSArray arrayWithObjects:appPath, userPath, sysPath, nil];
|
|
NSEnumerator *pathEnum = [paths objectEnumerator];
|
|
NSString *path;
|
|
|
|
while( path = [pathEnum nextObject] )
|
|
{
|
|
NSEnumerator *e = [[[NSFileManager defaultManager] directoryContentsAtPath:path] objectEnumerator];
|
|
NSString *name;
|
|
|
|
NSLog(@"Looking for resources in %@", path);
|
|
|
|
while( name = [e nextObject] )
|
|
{
|
|
name = [path stringByAppendingPathComponent:name];
|
|
NSLog(@"Examining %@", name);
|
|
if( [[name pathExtension] isEqualToString:@"rsrc"] )
|
|
{
|
|
[c openDocumentWithContentsOfFile:name display:YES];
|
|
//[[[[[c openDocumentWithContentsOfFile:name display:YES] windowControllers] objectAtIndex:0] window] orderOut: self];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@end
|