Ignore:
Timestamp:
05/25/06 17:46:45 (19 years ago)
Author:
rchin
Message:

Auto installation of F-Script as requested by Philippe Mougin. We'll optimize the FSA framework package later (not sure if it would be a good idea to remove headers in framework, etc.)

Location:
trunk/Cocoa/F-Script Anywhere/Source
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/F-Script Anywhere/Source/DeVercruesseProcessManager.m

    r7 r230  
    175175    }
    176176   
    177     [processes setSet: temp];
     177    [processes setSet:[temp autorelease]];
    178178    [pool release];
    179     [temp release];
    180179}
    181180
  • trunk/Cocoa/F-Script Anywhere/Source/F-Script Anywhere.xcodeproj/project.pbxproj

    r229 r230  
    1616                25666C4E0A1DAE4D0006AC79 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25666C4D0A1DAE4D0006AC79 /* Security.framework */; };
    1717                25666CA60A1DB1BD0006AC79 /* DSCL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 256669AD0A1D8DE30006AC79 /* DSCL.framework */; };
     18                258C27790A25A57200AC22BB /* FScript.framework in Resources */ = {isa = PBXBuildFile; fileRef = F5EFC2C3020A6C2601AEEDB1 /* FScript.framework */; };
    1819                25EADA9609CD2D7100BCD8E1 /* bytesex.c in Sources */ = {isa = PBXBuildFile; fileRef = 25EADA9509CD2D7100BCD8E1 /* bytesex.c */; };
    1920                E14C18BD05A4DE25000D4AF3 /* FSAInterpreterPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = F5680F7A020D0D0401AEEC37 /* FSAInterpreterPanel.nib */; };
     
    9495/* End PBXBuildFile section */
    9596
    96 /* Begin PBXBuildStyle section */
    97                 4A9504CCFFE6A4B311CA0CBA /* Development */ = {
    98                         isa = PBXBuildStyle;
    99                         buildSettings = {
    100                                 COPY_PHASE_STRIP = NO;
    101                                 GCC_DYNAMIC_NO_PIC = NO;
    102                                 GCC_ENABLE_FIX_AND_CONTINUE = YES;
    103                                 GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
    104                                 GCC_OPTIMIZATION_LEVEL = 0;
    105                                 OPTIMIZATION_CFLAGS = "-O0";
    106                                 ZERO_LINK = NO;
    107                         };
    108                         name = Development;
    109                 };
    110                 4A9504CDFFE6A4B311CA0CBA /* Deployment */ = {
    111                         isa = PBXBuildStyle;
    112                         buildSettings = {
    113                                 COPY_PHASE_STRIP = YES;
    114                                 GCC_ENABLE_FIX_AND_CONTINUE = NO;
    115                                 OTHER_CFLAGS = "-DFSA_DEBUG=0";
    116                                 ZERO_LINK = NO;
    117                         };
    118                         name = Deployment;
    119                 };
    120 /* End PBXBuildStyle section */
    121 
    12297/* Begin PBXContainerItemProxy section */
    12398                25666BE50A1DAA120006AC79 /* PBXContainerItemProxy */ = {
     
    125100                        containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
    126101                        proxyType = 1;
    127                         remoteGlobalIDString = 25666BE00A1DAA050006AC79 /* AddToProcMod */;
     102                        remoteGlobalIDString = 25666BE00A1DAA050006AC79;
    128103                        remoteInfo = AddToProcMod;
    129104                };
     
    179154                25666C0F0A1DACEB0006AC79 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
    180155                25666C4D0A1DAE4D0006AC79 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = "<absolute>"; };
     156                258C25590A259B6E00AC22BB /* FScript.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = FScript.framework; sourceTree = "<group>"; };
    181157                25EADA9509CD2D7100BCD8E1 /* bytesex.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = bytesex.c; path = "../Darwin source/Commands/Apple/cctools/libstuff/bytesex.c"; sourceTree = SOURCE_ROOT; };
    182158                29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
     
    204180                E1EE98BD0575626E00F2D92C /* mach_inject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = mach_inject.h; sourceTree = "<group>"; tabWidth = 4; usesTabs = 1; };
    205181                E1EE9A2F0575769600F2D92C /* Info-Application.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "Info-Application.plist"; sourceTree = "<group>"; };
    206                 E1EE9A300575769600F2D92C /* F-Script Anywhere.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = "F-Script Anywhere.app"; sourceTree = BUILT_PRODUCTS_DIR; };
     182                E1EE9A300575769600F2D92C /* F-Script Anywhere.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "F-Script Anywhere.app"; sourceTree = BUILT_PRODUCTS_DIR; };
    207183                E1EE9A4F057576A700F2D92C /* F-Script Anywhere.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "F-Script Anywhere.bundle"; sourceTree = BUILT_PRODUCTS_DIR; };
    208184                E1F3DF910579172A00E952A5 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/FSA.strings; sourceTree = "<group>"; };
     
    226202                F59279FB01FED0C901AEEC37 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
    227203                F5B11ED902E67DB101AEEDB1 /* VERSION */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = VERSION; sourceTree = "<group>"; };
    228                 F5EFC2C3020A6C2601AEEDB1 /* FScript.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FScript.framework; path = /Library/Frameworks/FScript.framework; sourceTree = "<absolute>"; };
     204                F5EFC2C3020A6C2601AEEDB1 /* FScript.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = FScript.framework; sourceTree = "<group>"; };
    229205                F5EFC2C9020A6CD101AEEDB1 /* DeVercruesseProcess.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = DeVercruesseProcess.m; sourceTree = "<group>"; };
    230206                F5EFC2CA020A6CD101AEEDB1 /* DeVercruesseProcessManager.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = DeVercruesseProcessManager.m; sourceTree = "<group>"; };
     
    343319                        isa = PBXGroup;
    344320                        children = (
     321                                258C25590A259B6E00AC22BB /* FScript.framework */,
    345322                                29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
    346323                                F5680F7A020D0D0401AEEC37 /* FSAInterpreterPanel.nib */,
     
    544521                        buildRules = (
    545522                        );
    546                         buildSettings = {
    547                                 GCC_ENABLE_FIX_AND_CONTINUE = YES;
    548                                 GCC_MODEL_TUNING = G5;
    549                                 INSTALL_PATH = "$(HOME)/bin";
    550                                 PREBINDING = NO;
    551                                 PRODUCT_NAME = AddToProcMod;
    552                                 ZERO_LINK = YES;
    553                         };
    554523                        dependencies = (
    555524                        );
     
    570539                        buildRules = (
    571540                        );
    572                         buildSettings = {
    573                                 GCC_PRECOMPILE_PREFIX_HEADER = YES;
    574                                 GCC_PREFIX_HEADER = "$(SDKROOT)/$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
    575                                 GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
    576                                 GCC_WARN_UNKNOWN_PRAGMAS = NO;
    577                                 INFOPLIST_FILE = "Bundle Loader-Info.plist";
    578                                 INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles";
    579                                 OTHER_CFLAGS = "";
    580                                 PRODUCT_NAME = SCPatchLoader;
    581                                 WARNING_CFLAGS = "-Wmost";
    582                         };
    583541                        dependencies = (
    584542                        );
     
    586544                        productName = Bundle;
    587545                        productReference = E1D652040575B3D50054F5D1 /* SCPatchLoader.bundle */;
    588                         productSettingsXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
    589 <!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
    590 <plist version=\"1.0\">
    591 <dict>
    592         <key>CFBundleDevelopmentRegion</key>
    593         <string>English</string>
    594         <key>CFBundleExecutable</key>
    595         <string>Bundle</string>
    596         <key>CFBundleGetInfoString</key>
    597         <string></string>
    598         <key>CFBundleIconFile</key>
    599         <string></string>
    600         <key>CFBundleIdentifier</key>
    601         <string>com.MySoftwareCompany.Bundle</string>
    602         <key>CFBundleInfoDictionaryVersion</key>
    603         <string>6.0</string>
    604         <key>CFBundlePackageType</key>
    605         <string>APPL</string>
    606         <key>CFBundleShortVersionString</key>
    607         <string></string>
    608         <key>CFBundleSignature</key>
    609         <string>????</string>
    610         <key>CFBundleVersion</key>
    611         <string>1.0.0d1</string>
    612 </dict>
    613 </plist>
    614 ";
    615546                        productType = "com.apple.product-type.bundle";
    616547                };
     
    629560                        buildRules = (
    630561                        );
    631                         buildSettings = {
    632                                 FRAMEWORK_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks";
    633                                 HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../Darwin source/Commands/Apple/cctools/include\"";
    634                                 INFOPLIST_FILE = "Info-Application.plist";
    635                                 INSTALL_PATH = /;
    636                                 LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../Darwin source/Commands/Apple/cctools/libstuff\"";
    637                                 OTHER_LDFLAGS = (
    638                                         "-multiply_defined",
    639                                         suppress,
    640                                         "-lstuff",
    641                                 );
    642                                 PREBINDING = YES;
    643                                 PRODUCT_NAME = "F-Script Anywhere";
    644                                 SECTORDER_FLAGS = "";
    645                                 WARNING_CFLAGS = (
    646                                         "-Wno-long-double",
    647                                         "-Wmost",
    648                                         "-Wno-four-char-constants",
    649                                         "-Wno-unknown-pragmas",
    650                                 );
    651                                 WRAPPER_EXTENSION = app;
    652                                 ZERO_LINK = NO;
    653                         };
    654562                        dependencies = (
    655563                                E1EE9AA60575939700F2D92C /* PBXTargetDependency */,
     
    674582                        buildRules = (
    675583                        );
    676                         buildSettings = {
    677                                 FRAMEWORK_SEARCH_PATHS = /Volumes/Ti/Library/Frameworks;
    678                                 GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
    679                                 GCC_WARN_UNKNOWN_PRAGMAS = NO;
    680                                 INFOPLIST_FILE = "Bundle-Info.plist";
    681                                 INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles";
    682                                 OTHER_CFLAGS = "";
    683                                 PRODUCT_NAME = "F-Script Anywhere";
    684                                 SECTORDER_FLAGS = "";
    685                         };
    686584                        dependencies = (
    687585                        );
     
    689587                        productName = Bundle;
    690588                        productReference = E1EE9A4F057576A700F2D92C /* F-Script Anywhere.bundle */;
    691                         productSettingsXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
    692 <!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
    693 <plist version=\"1.0\">
    694 <dict>
    695         <key>CFBundleDevelopmentRegion</key>
    696         <string>English</string>
    697         <key>CFBundleExecutable</key>
    698         <string>Bundle</string>
    699         <key>CFBundleGetInfoString</key>
    700         <string></string>
    701         <key>CFBundleIconFile</key>
    702         <string></string>
    703         <key>CFBundleIdentifier</key>
    704         <string>com.MySoftwareCompany.Bundle</string>
    705         <key>CFBundleInfoDictionaryVersion</key>
    706         <string>6.0</string>
    707         <key>CFBundlePackageType</key>
    708         <string>APPL</string>
    709         <key>CFBundleShortVersionString</key>
    710         <string></string>
    711         <key>CFBundleSignature</key>
    712         <string>????</string>
    713         <key>CFBundleVersion</key>
    714         <string>1.0.0d1</string>
    715 </dict>
    716 </plist>
    717 ";
    718589                        productType = "com.apple.product-type.bundle";
    719590                };
     
    724595                        isa = PBXProject;
    725596                        buildConfigurationList = 25EAD8F709CD1E3900BCD8E1 /* Build configuration list for PBXProject "F-Script Anywhere" */;
    726                         buildSettings = {
    727                                 MACOSX_DEPLOYMENT_TARGET = 10.2;
    728                                 SDKROOT = /Developer/SDKs/MacOSX10.2.7.sdk;
    729                         };
    730                         buildStyles = (
    731                                 4A9504CCFFE6A4B311CA0CBA /* Development */,
    732                                 4A9504CDFFE6A4B311CA0CBA /* Deployment */,
    733                         );
    734597                        hasScannedForEncodings = 1;
    735598                        mainGroup = 29B97314FDCFA39411CA2CEA /* PatchTest */;
     
    766629                                E1D6B7EA05A4AAE2003838B0 /* Localizable.strings in Resources */,
    767630                                E14C1ECF05A8DB19000D4AF3 /* Ellipsis.tiff in Resources */,
     631                                258C27790A25A57200AC22BB /* FScript.framework in Resources */,
    768632                                E1FD011605B91232001DABE0 /* mach_error descriptions.strings in Resources */,
    769633                        );
     
    954818                        isa = XCBuildConfiguration;
    955819                        buildSettings = {
     820                                ARCHS = (
     821                                        ppc,
     822                                        i386,
     823                                );
    956824                                COPY_PHASE_STRIP = YES;
    957                                 FRAMEWORK_SEARCH_PATHS = (
    958                                         "$(FRAMEWORK_SEARCH_PATHS)",
    959                                         "$(SRCROOT)",
    960                                 );
     825                                FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)\"";
    961826                                GCC_ENABLE_FIX_AND_CONTINUE = NO;
    962827                                GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
     
    1111976                                GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
    1112977                                GCC_OPTIMIZATION_LEVEL = 0;
    1113                                 HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../Darwin source/Commands/Apple/cctools/include\"";
     978                                HEADER_SEARCH_PATHS = (
     979                                        "$(HEADER_SEARCH_PATHS_QUOTED_1)",
     980                                );
     981                                HEADER_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../Darwin source/Commands/Apple/cctools/include\"";
    1114982                                INFOPLIST_FILE = "Info-Application.plist";
    1115983                                INSTALL_PATH = /;
    1116                                 LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../Darwin source/Commands/Apple/cctools/libstuff\"";
     984                                LIBRARY_SEARCH_PATHS = (
     985                                        "$(LIBRARY_SEARCH_PATHS_QUOTED_1)",
     986                                );
     987                                LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../Darwin source/Commands/Apple/cctools/libstuff\"";
    1117988                                OPTIMIZATION_CFLAGS = "-O0";
    1118989                                OTHER_LDFLAGS = (
     
    11451016                                FRAMEWORK_SEARCH_PATHS = (
    11461017                                        "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks",
    1147                                         "$(SRCROOT)",
    1148                                 );
     1018                                        "$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
     1019                                );
     1020                                FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)\"";
    11491021                                GCC_ENABLE_FIX_AND_CONTINUE = NO;
    1150                                 HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../Darwin source/Commands/Apple/cctools/include\"";
     1022                                HEADER_SEARCH_PATHS = (
     1023                                        "$(HEADER_SEARCH_PATHS_QUOTED_1)",
     1024                                );
     1025                                HEADER_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../Darwin source/Commands/Apple/cctools/include\"";
    11511026                                INFOPLIST_FILE = "Info-Application.plist";
    11521027                                INSTALL_PATH = /;
    1153                                 LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../Darwin source/Commands/Apple/cctools/libstuff\"";
     1028                                LIBRARY_SEARCH_PATHS = (
     1029                                        "$(LIBRARY_SEARCH_PATHS_QUOTED_1)",
     1030                                );
     1031                                LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../Darwin source/Commands/Apple/cctools/libstuff\"";
    11541032                                OTHER_CFLAGS = "-DFSA_DEBUG=0";
    11551033                                OTHER_LDFLAGS = (
     
    11571035                                        suppress,
    11581036                                        "-lstuff",
     1037                                        "-weak_framework",
     1038                                        FScript,
    11591039                                );
    11601040                                PREBINDING = YES;
     
    11781058                                        "$(SRCROOT)",
    11791059                                );
    1180                                 HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../Darwin source/Commands/Apple/cctools/include\"";
     1060                                HEADER_SEARCH_PATHS = (
     1061                                        "$(HEADER_SEARCH_PATHS_QUOTED_1)",
     1062                                );
     1063                                HEADER_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../Darwin source/Commands/Apple/cctools/include\"";
    11811064                                INFOPLIST_FILE = "Info-Application.plist";
    11821065                                INSTALL_PATH = /;
    1183                                 LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../Darwin source/Commands/Apple/cctools/libstuff\"";
     1066                                LIBRARY_SEARCH_PATHS = (
     1067                                        "$(LIBRARY_SEARCH_PATHS_QUOTED_1)",
     1068                                );
     1069                                LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../Darwin source/Commands/Apple/cctools/libstuff\"";
    11841070                                OTHER_LDFLAGS = (
    11851071                                        "-multiply_defined",
  • trunk/Cocoa/F-Script Anywhere/Source/FSAApp.h

    r153 r230  
    2626
    2727#import <Cocoa/Cocoa.h>
     28#import <Security/Authorization.h>
    2829#import "FSAAppList.h"
    2930
     
    4849    IBOutlet FSAAppList *appList;
    4950    FSAPatchController *patchController;
     51    AuthorizationRef myAuthorizationRef;
     52    AuthorizationFlags myFlags;
    5053}
    5154
    5255- (IBAction)installBundleInSelectedApp:(id)sender;
     56-(BOOL)createAuthorization;
    5357
    5458@end
  • trunk/Cocoa/F-Script Anywhere/Source/FSAApp.mm

    r229 r230  
    3030#import <CoreFoundation/CoreFoundation.h>
    3131#import <ApplicationServices/ApplicationServices.h>
    32 #import <Security/Authorization.h>
    3332#import <Security/AuthorizationTags.h>
    3433
     
    121120}
    122121
     122-(void)installFScript
     123{
     124    OSStatus myStatus;
     125
     126    NSString *installPath = nil;
     127    if([[NSFileManager defaultManager] fileExistsAtPath:@"/Library/Frameworks/FScript.framework"])
     128        installPath = @"/Library/Frameworks/FScript.framework";
     129    if([[NSFileManager defaultManager] fileExistsAtPath:[@"~/Library/Frameworks/FScript.framework" stringByExpandingTildeInPath]])
     130        installPath = [@"~/Library/Frameworks/FScript.framework" stringByExpandingTildeInPath];
     131   
     132    if(installPath){
     133        [[NSFileManager defaultManager] removeFileAtPath:installPath handler:nil];
     134    }
     135   
     136    if(!installPath){
     137        switch([[NSAlert alertWithMessageText:@"Install F-Script"
     138                                defaultButton:@"Current User"
     139                              alternateButton:@"All Users"
     140                                  otherButton:nil
     141                    informativeTextWithFormat:@"No previous version of F-Script found. You can choose to install for just your current user (~/Library/Frameworks) or for all users (/Library/Frameworks)."] runModal]){
     142            case NSAlertDefaultReturn:  // Current user
     143                installPath = [@"~/Library/Frameworks/FScript.framework" stringByExpandingTildeInPath];
     144                break;
     145            case NSAlertAlternateReturn: // All users
     146                installPath = @"/Library/Frameworks/FScript.framework";
     147                break;
     148            default:
     149                break;
     150        }       
     151    }
     152   
     153    NSString *fromPath = [[NSBundle mainBundle] pathForResource:@"FScript" ofType:@"framework"];
     154    if(![[NSFileManager defaultManager] fileExistsAtPath:[installPath stringByDeletingLastPathComponent]]){
     155        if ([[NSFileManager defaultManager] isWritableFileAtPath:installPath]){
     156            [[NSFileManager defaultManager] createDirectoryAtPath:[installPath stringByDeletingLastPathComponent]
     157                                                       attributes:nil];
     158        } else {
     159            [self createAuthorization];
     160            NSString *myToolPath = @"/bin/mkdir";
     161            char *myArguments[] = { (char *)[[installPath stringByDeletingLastPathComponent] UTF8String], NULL };
     162            myStatus = AuthorizationExecuteWithPrivileges(myAuthorizationRef, [myToolPath UTF8String],
     163                                                          myFlags, myArguments,
     164                                                          NULL);
     165        }
     166    }
     167    if([[NSFileManager defaultManager] isWritableFileAtPath:[installPath stringByDeletingLastPathComponent]]){
     168        [[NSFileManager defaultManager] copyPath:fromPath toPath:installPath handler:nil];
     169    } else {
     170        [self createAuthorization];
     171        NSString *myToolPath = @"/bin/cp";
     172        char *myArguments[] = { "-r", (char *)[fromPath UTF8String], (char *)[installPath UTF8String], NULL };
     173        myStatus = AuthorizationExecuteWithPrivileges(myAuthorizationRef, [myToolPath UTF8String],
     174                                                      myFlags, myArguments,
     175                                                      NULL);
     176    }   
     177}
     178
    123179- (BOOL)_shouldContinueAfterFrameworkErrorPanelReturnedWithResult:(int)result;
    124180{
     
    126182        case NSAlertOtherReturn:
    127183            return true;
    128         case NSAlertAlternateReturn:
    129             [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString: FSA_FScriptURL]];
     184        case NSAlertAlternateReturn: /* Install from resources */
     185            [self installFScript];
     186            return true;
    130187        case NSAlertDefaultReturn:
    131188        default:
     
    135192}
    136193
    137 -(tDirStatus)authorizeAndAddToProcMod:(NSString *)username
    138 {
     194-(BOOL)createAuthorization
     195{
     196    if(myAuthorizationRef)
     197        return YES;
     198   
    139199    OSStatus myStatus;
    140     AuthorizationFlags myFlags = kAuthorizationFlagDefaults;
    141     AuthorizationRef myAuthorizationRef;
     200    myFlags = kAuthorizationFlagDefaults;
    142201   
    143202    myStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment,
    144203                                   myFlags, &myAuthorizationRef);
    145204    if(myStatus != errAuthorizationSuccess)
    146         return eDSAuthFailed;
     205        return NO;
    147206   
    148207    AuthorizationItem myItems = {kAuthorizationRightExecute, 0, NULL, 0};
     
    157216   
    158217    if(myStatus != errAuthorizationSuccess)
     218        return NO;
     219   
     220    myFlags = kAuthorizationFlagDefaults;
     221    return YES;
     222}
     223
     224-(tDirStatus)authorizeAndAddToProcMod:(NSString *)username
     225{
     226    OSStatus myStatus;
     227   
     228    if(![self createAuthorization])
    159229        return eDSAuthFailed;
    160    
    161     myFlags = kAuthorizationFlagDefaults;
    162230   
    163231    NSString *myToolPath = [[NSBundle mainBundle] pathForResource:@"AddToProcMod" ofType:@""];
     
    176244    myReadBuffer[didRead - 1] = 0;
    177245   
    178     AuthorizationFree(myAuthorizationRef, kAuthorizationFlagDefaults);
    179 
    180246    return (tDirStatus)strtol(myReadBuffer, NULL, 10);
    181247}
     
    274340        int result = NSRunInformationalAlertPanel(
    275341            NSLocalizedString(@"F-Script Framework Not Found", "Framework not found alert title"),
    276             NSLocalizedString(@"F-Script Anywhere requires the F-Script framework be installed in a Frameworks directory, such as ~/Library/Frameworks or /Library/Frameworks.\n\nTo download F-Script, please visit its Web site\n%@.\n\nIf you believe this message is in error, click '%@'.",
     342            NSLocalizedString(@"F-Script Anywhere requires the F-Script framework be installed in a Frameworks directory, such as ~/Library/Frameworks or /Library/Frameworks.\n\nTo download F-Script, please visit its Web site\n%@.\n\nThis package also includes a copy of F-Script for your convenience that can be installed easily by clicking below. Note that there may be a more recent version of F-Script available from the F-Script web site.\n\nIf you believe this message is in error, click '%@'.",
    277343                              "Framework not found alert message, F-Script Web site URL parameter, 'Continue' button parameter"),
    278344            NSLocalizedString(@"Quit", "Quit button title"),
    279             NSLocalizedString(@"Get F-Script", "'Get F-Script' button title"),
     345            NSLocalizedString(@"Install F-Script", "'Get F-Script' button title"),
    280346            NSLocalizedString(@"Continue", "Continue button title"),
    281347            FSA_FScriptURL, NSLocalizedString(@"Continue", ""));
     
    290356            int result = NSRunInformationalAlertPanel(
    291357                NSLocalizedString(@"F-Script Framework Too Old", "Framework too old alert title"),
    292                 NSLocalizedString(@"F-Script Anywhere %s requires version %@ or later of the F-Script framework be installed in a Frameworks directory, such as ~/Library/Frameworks or /Library/Frameworks. The installed version is %@.\n\nTo upgrade F-Script, please visit its Web site\n%@.\n\nTo use this version of F-Script regardless of the problems you may experience, click '%@'.",
     358                NSLocalizedString(@"F-Script Anywhere %s requires version %@ or later of the F-Script framework be installed in a Frameworks directory, such as ~/Library/Frameworks or /Library/Frameworks. The installed version is %@.\n\nTo upgrade F-Script, please visit its Web site\n%@.\n\nThis package also includes a copy of F-Script for your convenience that can be installed easily by clicking below. Note that there may be a more recent version of F-Script available from the F-Script web site.\n\nTo use this version of F-Script regardless of the problems you may experience, click '%@'.",
    293359                                  "Framework too old alert message, FSA version parameter, minimum F-Script version parameter, current F-Script version parameter, F-Script Web site URL parameter, 'Continue' button parameter"),
    294360                NSLocalizedString(@"Quit", "Quit button title"),
    295                 NSLocalizedString(@"Get F-Script", "'Get F-Script' button title"),
     361                NSLocalizedString(@"Install F-Script", "'Get F-Script' button title"),
    296362                NSLocalizedString(@"Continue", "Continue button title"),
    297363                FSA_VERSION, FSA_FScriptMinimumVersion, frameworkVersion,
    298                 FSA_FScriptURL, NSLocalizedString(@"Continue", ""));
     364                FSA_FScriptURL, NSLocalizedString(@"Install F-Script", ""));
    299365            if (![self _shouldContinueAfterFrameworkErrorPanelReturnedWithResult: result]) return;
    300366        }
    301367    }
    302368
     369    if(myAuthorizationRef){
     370        AuthorizationFree(myAuthorizationRef, kAuthorizationFlagDefaults);
     371        myAuthorizationRef = nil;
     372    }
     373   
    303374    NSNotificationCenter *workspaceNotificationCenter = [[NSWorkspace sharedWorkspace] notificationCenter];
    304375    [workspaceNotificationCenter
  • trunk/Cocoa/F-Script Anywhere/Source/Read Me

    r229 r230  
    9191   (and if not, to prompt you if you want to add yourself) -- something
    9292   that is necessary for use of FSA on x86.
     93
     944. Unzip FScript.framework.zip, or put a newer version of FScript.framework
     95   in the project path. This is used for the FScript framework auto installer.
    9396   
    94 3. Open 'F-Script Anywhere.xcodeproj' in Xcode and build the Application
     975. Open 'F-Script Anywhere.xcodeproj' in Xcode and build the Application
    9598   target.  This target depends on the Bundle and Bundle Loader
    9699   targets, so you don't need to build them separately.  You
Note: See TracChangeset for help on using the changeset viewer.