Changeset 265


Ignore:
Timestamp:
07/20/06 11:16:20 (13 years ago)
Author:
Nicholas Riley
Message:

VERSION: Updated for 1.1d2.

main.c: Updated for 1.1d2. Added -L. Updated to new date formatting
APIs.

launch.xcodeproj: Set deployment target to 10.4.

README: Updated for 1.1d2.

Location:
trunk/launch/launch
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/launch/launch/README

    r214 r265  
    1 launch 1.0.1 [3 April 2005]
     1launch 1.1d2 [unreleased]
    22============
    33
     
    6363An Xcode project, 'launch.xcodeproj', is included.  A precompiled Universal
    6464binary is also provided.  'launch' was developed and tested under Mac OS X
    65 10.4.5 with Xcode 2.2.1, and does not require any additional software to
     6510.4.7 with Xcode 2.3, and does not require any additional software to
    6666build.
    6767
     
    223223
    2242241.1 - unreleased
     225 - -L: send "launch" (ascr/noop) event to app, bypasses automatic
    225226 - -o: pass command-line arguments (broken, r. 4474993)
     227   opening of untitled document, etc.
    226228 - display content type ID (UTI)   
    227229 - switched to new LSOpen APIs (now requires Mac OS X 10.4 or later)
     230 - switched to new date formatting APIs (the old ones are deprecated)
    228231 - for compatibility with open(1), take app path as argument to -a
    2292321.0.1 - 3 April 2005
  • trunk/launch/launch/VERSION

    r214 r265  
    1 1.1d1
     11.1d2
  • trunk/launch/launch/launch.xcodeproj/project.pbxproj

    r215 r265  
    206206                                        i386,
    207207                                );
    208                                 MACOSX_DEPLOYMENT_TARGET = 10.2;
     208                                MACOSX_DEPLOYMENT_TARGET = 10.4;
    209209                                SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
    210210                        };
     
    218218                                        i386,
    219219                                );
    220                                 MACOSX_DEPLOYMENT_TARGET = 10.2;
     220                                MACOSX_DEPLOYMENT_TARGET = 10.4;
    221221                                SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
    222222                        };
     
    230230                                        i386,
    231231                                );
    232                                 MACOSX_DEPLOYMENT_TARGET = 10.2;
     232                                MACOSX_DEPLOYMENT_TARGET = 10.4;
    233233                                SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
    234234                        };
  • trunk/launch/launch/main.c

    r214 r265  
    3333const char *APP_NAME;
    3434
    35 #define VERSION "1.1d1"
     35#define VERSION "1.1d2"
    3636
    3737#define STRBUF_LEN 1024
     
    9292
    9393void usage() {
    94     fprintf(stderr, "usage: %s [-npswbmhCXU] [-c creator] [-i bundleID] [-u URL] [-a name] [-o argument] [item ...] [-]\n"
    95                     "   or: %s [-npflswbmhCXU] [-o argument] item ...\n", APP_NAME, APP_NAME);
     94    fprintf(stderr, "usage: %s [-npswbmhCXLU] [-c creator] [-i bundleID] [-u URL] [-a name] [-o argument] [item ...] [-]\n"
     95                    "   or: %s [-npflswbmhCXLU] [-o argument] item ...\n", APP_NAME, APP_NAME);
    9696    fprintf(stderr,
    9797        "  -n            print matching paths/URLs instead of opening them\n"
     
    108108        "  -C            force CFM/PEF Carbon application to launch in Classic\n"
    109109        "  -X            don't start Classic for this app if Classic isn't running\n"
     110        "  -L            suppress normal opening behavior (e.g. untitled window)\n"
    110111        "  -U            interpret items as URLs, even if same-named files exist\n"
    111112        "  -c creator    match application by four-character creator code ('ToyS')\n"
     
    331332    if (argc == 1) usage();
    332333   
    333     while ( (ch = getopt(argc, argv, "npflswbmhCXUc:i:u:a:o:")) != -1) {
     334    while ( (ch = getopt(argc, argv, "npflswbmhCXLUc:i:u:a:o:")) != -1) {
    334335        switch (ch) {
    335336        case 'n':
     
    374375        case 'C': LPARAMS.flags |= kLSLaunchInClassic; break;  // force Classic
    375376        case 'X': LPARAMS.flags ^= kLSLaunchStartClassic; break;// don't start Classic for app
     377        case 'L':
     378        {
     379            OSStatus err;
     380            LPARAMS.initialEvent = malloc(sizeof(AppleEvent));
     381            err = AECreateAppleEvent(kASAppleScriptSuite, kASLaunchEvent, NULL, kAutoGenerateReturnID, kAnyTransactionID, LPARAMS.initialEvent);
     382            if (err != noErr) osstatusexit(err, "unable to construct launch Apple Event", argv[0]);
     383        }
    376384        case 'U': OPTS.forceURLs = true; break;
    377385        case 'c':
     
    531539
    532540void printDateTime(const char *label, UTCDateTime *utcTime, const char *postLabel, Boolean printIfEmpty) {
    533     static Str255 dateStr, timeStr;
    534     LocalDateTime localTime;
    535     LongDateTime longTime;
     541    static CFDateFormatterRef formatter = NULL;
     542    static char strBuffer[STRBUF_LEN];
     543    if (formatter == NULL) {
     544        formatter = CFDateFormatterCreate(NULL, CFLocaleCopyCurrent(), kCFDateFormatterShortStyle, kCFDateFormatterMediumStyle);
     545    }
     546    CFAbsoluteTime absoluteTime;
    536547    OSStatus err;
    537548
    538     err = ConvertUTCToLocalDateTime(utcTime, &localTime);
     549    err = UCConvertUTCDateTimeToCFAbsoluteTime(utcTime, &absoluteTime);
    539550    if (err == kUTCUnderflowErr) {
    540551        if (printIfEmpty) printf("\t%s: (not set)\n", label);
    541552        return;
    542553    }
    543     if (err != noErr) osstatusexit(err, "unable to convert UTC %s date to local", label);
    544 
    545     longTime = localTime.highSeconds;
    546     longTime <<= 32;
    547     longTime |= localTime.lowSeconds;
    548 
    549     // strings include trailing newlines; strip them.
    550     LongDateString(&longTime, shortDate, dateStr, nil); dateStr[dateStr[0] + 1] = '\0';
    551     LongTimeString(&longTime, true, timeStr, nil); timeStr[timeStr[0] + 1] = '\0';
    552     printf("\t%s: %s %s%s\n", label, dateStr + 1, timeStr + 1, postLabel);
     554    if (err != noErr) osstatusexit(err, "unable to convert UTC %s time", label);
     555
     556    CFStringRef dateTimeString = CFDateFormatterCreateStringWithAbsoluteTime(NULL, formatter, absoluteTime);
     557    CFStringGetCString(dateTimeString, strBuffer, STRBUF_LEN, kCFStringEncodingUTF8);
     558   
     559    printf("\t%s: %s%s\n", label, strBuffer, postLabel);
    553560}
    554561
Note: See TracChangeset for help on using the changeset viewer.