Farbflash projects: Imaging lingo table | 3-D scene list | Find all | Handler menu | Lingo message window

Ignore:
Timestamp:
02/21/08 07:51:08 (4 years ago)
Author:
alex
Message:

added functions for lingodoc snippets and fixed issues with external script editors on mac

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lingosource/castlib1/bbedit_Utilities.ls

    r151 r153  
    147147           
    148148          theResult = mSaveTextToTempFile(me, theText, tempSrcHFSPath) 
    149           --------------------- 
    150            
    151           mDoShellCmd(me, "bbedit " & tempSrcPath) 
     149           
     150          if theResult = 0 then 
     151            alert "Unable to save temp file:" && tempSrcHFSPath 
     152          else 
     153            mDoShellCmd(me, "bbedit " & tempSrcPath) 
     154          end if 
     155           
    152156           
    153157        end if 
     
    206210  sel = the selection of castlib cl 
    207211   
    208   if mCheckForXtra(me, "BudAPI") then 
    209     --    tempFolder = basysfolder("temp") 
    210      
    211     if the platform contains "mac" then 
    212        
    213       isMac = 1 
    214       resetUNames = 0 
    215       if baSysFolder("prefs") starts "/" then 
    216         baReturnUnixNames(0) 
    217         resetUNames = 1 
    218       end if 
    219       tempFolderHFS = basysfolder("temp") 
    220       baReturnUnixNames(1) 
    221       tempFolder = basysfolder("temp") 
    222       if resetUNames = 0 then 
    223         baReturnUnixNames(0) 
    224       end if 
    225        
    226     else 
    227       tempFolderHFS = basysfolder("temp") 
    228       tempFolder = tempFolderHFS 
    229     end if 
    230      
    231      
    232   else 
    233     alert "You need the buddyApi xtra for this operation" 
    234     exit 
    235   end if 
     212  isMac = (the platform contains "mac") 
    236213   
    237214  editor = mGetExternalScriptEditor(me) 
     
    258235        if doLiveEdit then 
    259236          --------------------- 
    260           tempSrcPath = tempFolder & "temp_LingoScript_file.ls" 
     237          tempSrcHFSPath = mGetTempFilePath(me, "temp_LingoScript_file.ls") 
    261238           
    262239          if isMac then 
    263240            waitparam = "" 
    264241            editor = mGetMacBinary(me, editor) 
    265             tempSrcHFSPath = mConvertUnix2Hfs(me, tempSrcPath) 
     242            tempSrcPath = mConvertHfs2Unix(me, tempSrcHFSPath) 
    266243          else 
    267             waitparam = " \w" 
    268             tempSrcHFSPath = tempSrcPath 
     244            waitparam = " /wait" 
     245            tempSrcPath = tempSrcHFSPath 
    269246          end if 
    270247          --------------------- 
     
    272249          theResult = mSaveTextToTempFile(me, theText, tempSrcHFSPath) 
    273250           
    274           mDoShellCmd(me, QUOTE & editor & QUOTE && tempSrcPath & waitparam) 
    275            
    276           theText = mGetTextFromFile(me, tempSrcHFSPath) 
    277            
    278           theText = mForceMacLineBreaks(me, theText) 
    279            
    280           if theType = #script then 
    281             memref.scripttext = theText 
    282           else if theType = #text then 
    283             memref.html = theText 
    284           else if theType = #field then 
    285             memref.text = theText 
     251          if theResult = 0 then 
     252            alert "Unable to save temp file:" && tempSrcHFSPath 
     253          else 
     254             
     255            mDoShellCmd(me, QUOTE & editor & QUOTE && tempSrcPath & waitparam) 
     256             
     257            theText = mGetTextFromFile(me, tempSrcHFSPath) 
     258             
     259            if length(theText) < 1 then 
     260              alert "Temp file:" && tempSrcHFSPath && "contains no text. Changes will not be written to script." 
     261               
     262            else 
     263               
     264              theText = mForceMacLineBreaks(me, theText) 
     265               
     266              if theType = #script then 
     267                memref.scripttext = theText 
     268              else if theType = #text then 
     269                memref.html = theText 
     270              else if theType = #field then 
     271                memref.text = theText 
     272              end if 
     273               
     274            end if 
     275             
    286276          end if 
    287277           
     
    295285          --------------------- 
    296286          -- create a temporary file from scripttext: 
    297           tempSrcPath = tempFolder & theName & ".ls" 
     287          tempSrcHFSPath = mGetTempFilePath(me, theName & ".ls") 
    298288           
    299289          if isMac then 
    300290            waitparam = " &" 
    301             editor = "" 
    302             tempSrcHFSPath = tempSrcPath 
     291            editor = mGetMacBinary(me, editor) 
     292            tempSrcPath = tempSrcHFSPath 
    303293          else 
    304294            waitparam = "" 
    305             tempSrcHFSPath = tempSrcPath 
     295            tempSrcPath = tempSrcHFSPath 
    306296          end if 
    307297           
     
    309299          --------------------- 
    310300           
    311           mDoShellCmd(me, QUOTE & editor & QUOTE && tempSrcPath & waitparam) 
     301          if theResult = 0 then 
     302            alert "Unable to save temp file:" && tempSrcHFSPath 
     303          else 
     304            mDoShellCmd(me, QUOTE & editor & QUOTE && tempSrcPath & waitparam) 
     305          end if 
    312306           
    313307        end if 
     
    355349          #field: memref.text = theText 
    356350        end case 
     351         
     352      else 
     353        alert "Temp file:" && tempSrcPath && "contains no text. Changes will not be written to script." 
    357354         
    358355      end if 
Note: See TracChangeset for help on using the changeset viewer.