mirror of
https://github.com/nickshanks/ResKnife.git
synced 2025-01-13 09:30:16 +00:00
Add RKSupportResourceRegistry that opens a couple of files in
{/Library, ~/Library}/Application Support/ResKnife/Support Resources/ and ResKnife.app/Contents/Resources/Support Resources/
This commit is contained in:
parent
175adc09d2
commit
d5662e1914
@ -8,6 +8,8 @@
|
|||||||
#import "ResourceDataSource.h"
|
#import "ResourceDataSource.h"
|
||||||
|
|
||||||
#import "ResknifePluginProtocol.h"
|
#import "ResknifePluginProtocol.h"
|
||||||
|
#import "RKSupportResourceRegistry.h"
|
||||||
|
|
||||||
|
|
||||||
@implementation ApplicationDelegate
|
@implementation ApplicationDelegate
|
||||||
|
|
||||||
@ -22,7 +24,8 @@
|
|||||||
{
|
{
|
||||||
// instanciate my own subclass of NSDocumentController so I can override the open dialog
|
// instanciate my own subclass of NSDocumentController so I can override the open dialog
|
||||||
RKDocumentController *docController = [[RKDocumentController alloc] init];
|
RKDocumentController *docController = [[RKDocumentController alloc] init];
|
||||||
#pragma unused( docController )
|
|
||||||
|
[RKSupportResourceRegistry scanForSupportResources: [NSDocumentController sharedDocumentController]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)awakeFromNib
|
- (void)awakeFromNib
|
||||||
|
20
Cocoa/Classes/RKSupportResourceRegistry.h
Normal file
20
Cocoa/Classes/RKSupportResourceRegistry.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// RKSupportResourceRegistry.h
|
||||||
|
// ResKnife
|
||||||
|
//
|
||||||
|
// Created by Uli Kusterer on Mon Aug 18 2003.
|
||||||
|
// Copyright (c) 2003 __MyCompanyName__. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <AppKit/AppKit.h>
|
||||||
|
|
||||||
|
|
||||||
|
@interface RKSupportResourceRegistry : NSObject
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
+(void) scanForSupportResources: (NSDocumentController*)c;
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
45
Cocoa/Classes/RKSupportResourceRegistry.m
Normal file
45
Cocoa/Classes/RKSupportResourceRegistry.m
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
//
|
||||||
|
// 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
|
@ -673,6 +673,7 @@ static NSString *RKExportItemIdentifier = @"com.ulikusterer.resknife.toolbar.ex
|
|||||||
if( !fork ) DisposePtr( (Ptr) resourceForkName ); // only delete if we're not saving it to "fork" instance var.
|
if( !fork ) DisposePtr( (Ptr) resourceForkName ); // only delete if we're not saving it to "fork" instance var.
|
||||||
if( fileRefNum ) FSClose( fileRefNum );
|
if( fileRefNum ) FSClose( fileRefNum );
|
||||||
DisposePtr( (Ptr) fileRef );
|
DisposePtr( (Ptr) fileRef );
|
||||||
|
|
||||||
return succeeded;
|
return succeeded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -839,6 +839,30 @@
|
|||||||
settings = {
|
settings = {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
3D53A9FD04F171DC006651FA = {
|
||||||
|
fileEncoding = 4;
|
||||||
|
isa = PBXFileReference;
|
||||||
|
path = RKSupportResourceRegistry.h;
|
||||||
|
refType = 4;
|
||||||
|
};
|
||||||
|
3D53A9FE04F171DC006651FA = {
|
||||||
|
fileEncoding = 4;
|
||||||
|
isa = PBXFileReference;
|
||||||
|
path = RKSupportResourceRegistry.m;
|
||||||
|
refType = 4;
|
||||||
|
};
|
||||||
|
3D53A9FF04F171DC006651FA = {
|
||||||
|
fileRef = 3D53A9FD04F171DC006651FA;
|
||||||
|
isa = PBXBuildFile;
|
||||||
|
settings = {
|
||||||
|
};
|
||||||
|
};
|
||||||
|
3D53AA0004F171DC006651FA = {
|
||||||
|
fileRef = 3D53A9FE04F171DC006651FA;
|
||||||
|
isa = PBXBuildFile;
|
||||||
|
settings = {
|
||||||
|
};
|
||||||
|
};
|
||||||
//3D0
|
//3D0
|
||||||
//3D1
|
//3D1
|
||||||
//3D2
|
//3D2
|
||||||
@ -2823,6 +2847,7 @@
|
|||||||
F59481AF03D0776C01A8010A,
|
F59481AF03D0776C01A8010A,
|
||||||
F59481B303D077DC01A8010A,
|
F59481B303D077DC01A8010A,
|
||||||
3D35755E04DAEB6200B8225B,
|
3D35755E04DAEB6200B8225B,
|
||||||
|
3D53A9FF04F171DC006651FA,
|
||||||
);
|
);
|
||||||
isa = PBXHeadersBuildPhase;
|
isa = PBXHeadersBuildPhase;
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@ -2880,6 +2905,7 @@
|
|||||||
F59481B403D077DC01A8010A,
|
F59481B403D077DC01A8010A,
|
||||||
3D35755B04DAEB4300B8225B,
|
3D35755B04DAEB4300B8225B,
|
||||||
3D35755F04DAEB6200B8225B,
|
3D35755F04DAEB6200B8225B,
|
||||||
|
3D53AA0004F171DC006651FA,
|
||||||
);
|
);
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@ -2940,6 +2966,8 @@
|
|||||||
F5B5882E0156D40B01000001,
|
F5B5882E0156D40B01000001,
|
||||||
3D35755C04DAEB6200B8225B,
|
3D35755C04DAEB6200B8225B,
|
||||||
3D35755D04DAEB6200B8225B,
|
3D35755D04DAEB6200B8225B,
|
||||||
|
3D53A9FD04F171DC006651FA,
|
||||||
|
3D53A9FE04F171DC006651FA,
|
||||||
F5B5882F0156D40B01000001,
|
F5B5882F0156D40B01000001,
|
||||||
F5B588300156D40B01000001,
|
F5B588300156D40B01000001,
|
||||||
F5B588310156D40B01000001,
|
F5B588310156D40B01000001,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user