Changeset 983


Ignore:
Timestamp:
Apr 15, 2010 9:46:13 AM (11 years ago)
Author:
toby
Message:

Fix Resource fork on Mac 4 real

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/expgui

    r953 r983  
    41854185#    $expgui(fm).file.menu.track add radiobutton -command {SetSVNbranch stable} -label Standard -value stable \
    41864186#       -variable expgui(SVNversion)
    4187     # get info about the current CMPR version on the server. Someday we might want to compare this
     4187    # get info about the current version on the server. Someday we might want to compare this
    41884188    # say every month and notify when there is a new version to update
    41894189    set repos [GetSVNrepository $expgui(gsasdir)]
  • trunk/gsascmds.tcl

    r982 r983  
    28002800}
    28012801
     2802proc MacMakeResource {file app} {
     2803    # make a resource file. Note that OS X has gotten picky about the length of this
     2804    set l [string length $app]
     2805    if $::expgui(debug) {puts "$l bytes"}
     2806    incr l
     2807    if $::expgui(debug) {puts "$l bytes after incr"}
     2808    set str "data 'usro' (0) {\n"
     2809    append str "  $\""
     2810    append str [format %.8X $l]
     2811    set bytes 4
     2812    foreach char [split $app {}] {
     2813        append str [format %.2X [scan $char %c]]   
     2814    }
     2815    incr bytes $l
     2816    set newline 1
     2817    for {set i 0} {$i < [expr 1028-$bytes]} {incr i} {
     2818        if $newline {
     2819            append str "\" \n"
     2820            append str "  $\""
     2821            set newline 0
     2822            set j 0
     2823        }
     2824        append str {0000 }
     2825        incr bytes
     2826        incr j 2
     2827        if {$j > 15} {set newline 1}
     2828    }
     2829    if {$l % 2} {
     2830        append str "\"\n "
     2831    } else {
     2832        # even lengths need one more byte
     2833        append str "00\"\n "
     2834    }
     2835    append str "/* $app */\n};\n"
     2836    set fp [open $file w]
     2837    puts $fp $str
     2838    close $fp
     2839}
     2840
    28022841# modify resource fork info for a .EXP file on the Mac
    28032842proc MacSetResourceFork {expfile} {
     
    28102849    set app [file nativename [file join $expgui(gsasdir) expgui.app]]
    28112850    set RezApp {}
    2812     foreach pth "/usr/bin  /Developer/Tools/Rez $expgui(gsasexe)" {
     2851    foreach pth "/usr/bin  /Developer/Tools $expgui(gsasexe)" {
    28132852        if [file exists [set tst [file join $pth Rez]]] {
    28142853            set RezApp $tst
     
    28172856    }
    28182857    set SetFileApp {}
    2819     foreach pth "/usr/bin  /Developer/Tools/Rez $expgui(gsasexe)" {
     2858    foreach pth "/usr/bin  /Developer/Tools $expgui(gsasexe)" {
    28202859        if [file exists [set tst [file join $pth SetFile]]] {
    28212860            set SetFileApp $tst
     
    28252864    if $::expgui(debug) {puts "found app=$app Rez=$RezApp and SetFile=$SetFileApp"}
    28262865    if {[file exists $app] && $RezApp != ""} {
    2827         # make a resource file. Note that OS X has gotten picky about the length of this
    2828         set l [string length $app]; incr l
    2829         set str "data 'usro' (0) {\n"
    2830         append str "  $\""
    2831         append str [format %.8X $l]
    2832         set bytes 4
    2833         foreach char [split $app {}] {
    2834            append str [format %.2X [scan $char %c]]   
    2835         }
    2836         incr bytes $l
    2837         set newline 1
    2838         for {set i 0} {$i < [expr 1028-$bytes]} {incr i} {
    2839             if $newline {
    2840                 append str "\" \n"
    2841                 append str "  $\""
    2842                 set newline 0
    2843                 set j 0
    2844             }
    2845             append str {0000 }
    2846             incr bytes
    2847             incr j 2
    2848             if {$j > 15} {set newline 1}
    2849         }
    2850         append str "00\"\n "
    2851         append str "/* $app */\n};\n"
    2852         set fp [open setapp.r w]
    2853         puts $fp $str
    2854         close $fp
     2866        # make resource file
     2867        MacMakeResource setapp.r $app
    28552868        if $::expgui(debug) {puts "$RezApp setapp.r -o $expnative -a"}
    28562869        exec $RezApp setapp.r -o $expnative -a
Note: See TracChangeset for help on using the changeset viewer.