Re: Installing into multiple locations w/ menu
Re: Installing into multiple locations w/ menu
- Subject: Re: Installing into multiple locations w/ menu
- From: Stéphane Sudre <email@hidden>
- Date: Thu, 5 Jun 2008 23:14:18 +0200
On Jun 5, 2008, at 9:28 PM, Paul Miller wrote:
Stéphane Sudre wrote:
On Jun 5, 2008, at 6:12 PM, Paul Miller wrote:
I have a Photoshop plugin I need to potentially install into
multiple locations (multiple Photoshop versions). I'd like to
preset a menu to the user, listing the appropriate Photoshop
installations found, and allow the user to check off the
locations they want, then automatically copy the plugin into the
proper locations (which are nested inside the plugin folders). Is
this possible with an Installer Plugin for OS X 10.4 and up?
At the very least, I'd like to automatically find an appropriate
Photoshop installation location and present that as the default
install location. I haven't found a way to do that yet using
scripting. Is that possible?
The problem we have is people do not read the installation
instructions and end up installing the plugin into the default
location (since we can't preset the default location to an
appropriate place). Then they complain when the plugin doesn't
show up in Photoshop. It would be ideal to not allow them to
install until an appropriate location is either discovered
automatically or selected by the user.
Any suggestions on how to deal with either of these problems?
A solution for the many to one case:
- look for the location(s) of Photoshop.
- display that in the Installation Pane.
- When the user has selected the one they want, create a symbolic
to the destination folder in /tmp.
I haven't found any documentation on doing these last two steps.
Have any pointers?
It requires Cocoa/Objective-C/C knowledge. You would use NSTableView,
a data source that would be your pane controller. To create the
symbolic link, you can use symlink();.
It's probably 50 lines of code.
Something like this:
#import <Cocoa/Cocoa.h>
#import <InstallerPlugins/InstallerPlugins.h>
@interface PhotoshopSelectorPane : InstallerPane
{
IBOutlet id IBarray_;
// Data
int selectedInstanceIndex_;
NSMutableArray * array_;
}
@end
-----------------------------------------
#import "PhotoshopSelectorPane.h"
#include <unistd.h>
@implementation PhotoshopSelectorPane
- (void) awakeFromNib
{
NSButtonCell * tPrototypeCell = nil;
NSTableColumn *tableColumn = nil;
tableColumn = [IBoutlineView_ tableColumnWithIdentifier: @"State"];
tPrototypeCell = [[NSButtonCell alloc] initTextCell: @""];
[tPrototypeCell setControlSize:NSSmallControlSize];
[tPrototypeCell setEditable: YES];
[tPrototypeCell setButtonType: NSRadioButton];
[tPrototypeCell setImagePosition: NSImageOnly];
[tableColumn setDataCell:tPrototypeCell];
[tPrototypeCell release];
// Do some work here to find the possible paths
[IBarray_ reloadData];
}
- (NSString *)title
{
return [[NSBundle bundleForClass:[self class]]
localizedStringForKey:@"PaneTitle" value:nil table:nil];
}
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
return [array_ count];
}
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:
(NSTableColumn *)aTableColumn row:(int)rowIndex
{
if ([[aTableColumn identifier] isEqualToString: @"State"])
{
return [NSNumber numberWithBool:
(rowIndex==selectedInstanceIndex_)];
}
else
if ([[aTableColumn identifier] isEqualToString: @"Location"])
{
return [array_ objectAtIndex:rowIndex];
}
return nil;
}
- (void) tableView:(NSTableView *)tableView setObjectValue:(id)object
forTableColumn:(NSTableColumn *)tableColumn row:(int)row
{
if ([[aTableColumn identifier] isEqualToString: @"State"])
{
selectedInstanceIndex_=row;
}
}
#pragma mark -
- (void) willExitPane:(InstallerSectionDirection) inDirection
{
if (inDirection==InstallerDirectionForward)
{
if (-1==symlink([[array_ objectAtIndex:selectedInstanceIndex_]
fileSystemRepresentation],"/tmp/something"))
}
}
@end
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Installer-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden