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

Ignore:
Timestamp:
02/19/08 13:54:27 (4 years ago)
Author:
alex
Message:

fixed problems with compare scripts, when there were not enough permissions on mac osx

File:
1 edited

Legend:

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

    r148 r151  
    108108          --------------------- 
    109109          -- create a temporary file from scripttext: 
    110           -- tempSrcPath = shell_cmd_list("mktemp -t temp_BBEdit_file.ls") 
    111           -- tempSrcPath = tempSrcPath[1] 
    112           tempSrcPath = "/tmp/temp_BBEdit_file.ls" 
    113            
    114           --          tempSrcHFSPath = mDoShellCmd(me, "osascript -e" && QUOTE & "return POSIX file \" & QUOTE & tempSrcPath & "\" & QUOTE & " as string" & QUOTE, 1) 
    115           --  tempSrcHFSPath = tempSrcHFSPath[1] 
    116           tempSrcHFSPath = mConvertUnix2Hfs(me, tempSrcPath) 
     110          tempSrcHFSPath = mGetTempFilePath(me, "temp_BBEdit_file.ls") 
     111          tempSrcPath = mConvertHfs2Unix(me, tempSrcHFSPath) 
    117112           
    118113           
     
    120115          --------------------- 
    121116           
    122           mDoShellCmd(me, "bbedit --wait --resume " & tempSrcPath) 
    123            
    124           theText = mGetTextFromFile(me, tempSrcHFSPath) 
    125            
    126           if theType = #script then 
    127             memref.scripttext = theText 
    128           else if theType = #text then 
    129             memref.html = theText 
    130           else if theType = #field then 
    131             memref.text = theText 
     117          if theResult = 0 then 
     118            alert "Unable to save file:" && tempSrcHFSPath 
     119          else 
     120            mDoShellCmd(me, "bbedit --wait --resume " & tempSrcPath) 
     121             
     122            theText = mGetTextFromFile(me, tempSrcHFSPath) 
     123             
     124            if length(theText) < 1 then 
     125              alert "Something seems wrong: the length of the new text is 0, nating changed. If this was puprosely an empty text, please delete by hand." 
     126            else 
     127              if theType = #script then 
     128                memref.scripttext = theText 
     129              else if theType = #text then 
     130                memref.html = theText 
     131              else if theType = #field then 
     132                memref.text = theText 
     133              end if 
     134            end if 
    132135          end if 
    133            
    134136           
    135137        else 
     
    139141            theName = "member_" & memref.membernum & "_" & memref.castlibnum 
    140142          end if 
    141           --------------------- 
    142           -- create a temporary file from scripttext: 
    143           if mCheckForXtra(me, "BudAPI") then 
    144              
    145             resetUNames = 0 
    146             if baSysFolder("prefs") starts "/" then 
    147               baReturnUnixNames(0) 
    148               resetUNames = 1 
    149             end if 
    150             tempSrcHFSPath = basysfolder("temp") & theName & ".ls" 
    151             baReturnUnixNames(1) 
    152             tempSrcPath = basysfolder("temp") & theName & ".ls" 
    153             if resetUNames = 0 then 
    154               baReturnUnixNames(0) 
    155             end if   
    156           else 
    157             tempSrcPath = "/tmp/" & theName & ".ls" 
    158             tempSrcHFSPath = mConvertUnix2Hfs(me, tempSrcPath) 
    159           end if 
     143           
     144          tempSrcPath = mGetTempFilePath(me, theName & ".ls") 
     145          tempSrcHFSPath = mConvertUnix2Hfs(me, tempSrcPath) 
    160146           
    161147           
     
    356342      end if 
    357343       
    358       if not(the platform contains "mac") then 
    359         if mCheckForXtra(me, "BudAPI") then 
    360           tempSrcPath = basysfolder("temp") 
    361           put theName & ".ls" after tempSrcPath 
    362         else 
    363           alert "You need the buddyApi xtra for this operation" 
    364           exit 
    365         end if 
    366       else 
    367         delim = the last char of the moviepath 
    368         olddelim = the itemdelimiter 
    369         the itemdelimiter = delim 
    370         hd = item 1 of getosdirectory() 
    371          
    372         tempSrcPath = hd & delim & "tmp" & delim & theName & ".ls" 
    373         the itemdelimiter = olddelim 
    374       end if 
     344      tempSrcPath = mGetTempFilePath(me, theName & ".ls") 
    375345       
    376346      theText = mGetTextFromFile(me, tempSrcPath) 
     
    642612  --------------------- 
    643613  -- create a temporary file from scripttext: 
    644   --  tempSrcPath = shell_cmd_list("mktemp -t temp_BBDiff_file1") 
    645   --  tempSrcPath = tempSrcPath[1] 
    646   tempSrcPath = "/tmp/temp_BBDiff_file1.ls" 
    647    
    648   -- tempSrcHFSPath = mDoShellCmd(me, "osascript -e" && QUOTE & "return POSIX file \" & QUOTE & tempSrcPath & "\" & QUOTE & " as string" & QUOTE, 1) 
    649   -- tempSrcHFSPath = tempSrcHFSPath[1] 
    650   tempSrcHFSPath = mConvertUnix2Hfs(me, tempSrcPath) 
     614   
     615  tempSrcHFSPath = mGetTempFilePath(me, "temp_BBDiff_file1.ls") 
     616  tempSrcPath = mConvertHfs2unix(me, tempSrcHFSPath) 
    651617   
    652618  st1 = memref1.scripttext 
    653619  theResult = mSaveTextToTempFile(me, st1, tempSrcHFSPath) 
     620   
     621  if theResult = 0 then 
     622    alert "Problems saving file:" && tempSrcHFSPath && "Can't proceed" 
     623    exit 
     624  end if 
    654625  --------------------- 
    655626   
     
    670641    --------------------- 
    671642    -- create a temporary file from scripttext: 
    672     --    tempSrcPath2 = shell_cmd_list("mktemp -t temp_BBDiff_file2") 
    673     --    tempSrcPath2 = tempSrcPath2[1] 
    674     tempSrcPath2 = "/tmp/temp_BBDiff_file2.ls" 
    675      
    676     -- tempSrcHFSPath2 = mDoShellCmd(me, "osascript -e" && QUOTE & "return POSIX file \" & QUOTE & tempSrcPath2 & "\" & QUOTE & " as string" & QUOTE, 1) 
    677     -- tempSrcHFSPath2 = tempSrcHFSPath2[1] 
    678     tempSrcHFSPath2 = mConvertUnix2Hfs(me, tempSrcPath2) 
     643    tempSrcHFSPath2 = mGetTempFilePath(me, "temp_BBDiff_file2.ls") 
     644    tempSrcPath2 = mConvertHfs2unix(me, tempSrcHFSPath2) 
    679645     
    680646    comm = tempSrcPath2 
    681647     
    682648    theResult = mSaveTextToTempFile(me, st2, tempSrcHFSPath2) 
     649    if theResult = 0 then 
     650      alert "Problems saving file:" && tempSrcHFSPath && "Can't proceed" 
     651      exit 
     652    end if 
    683653    --------------------- 
    684654     
     
    14111381                    else 
    14121382                       
    1413                       tempSrcPath = "/tmp/temp_BBEdit_file.ls" 
    1414                       tempSrcHFSPath = mConvertUnix2Hfs(me, tempSrcPath) 
     1383                      tempSrcHFSPath = mGetTempFilePath(me, "temp_BBEdit_file.ls") 
     1384                      tempSrcPath = mConvertHfs2unix(me, tempSrcHFSPath) 
    14151385                       
    1416                       mSaveTextToTempFile(me, memref.scripttext, tempSrcHFSPath) 
     1386                      theResult = mSaveTextToTempFile(me, memref.scripttext, tempSrcHFSPath) 
     1387                      if theResult <> 0 then 
     1388                         
     1389                        if char 1 of comm = "~" then put "$HOME" into char 1 of comm 
     1390                         
     1391                        mDoShellCmd(me, bbdiffpath & " --ignore-curly-quotes --ignore-spaces --wait --resume " &QUOTE& tempSrcPath &QUOTE&&QUOTE& comm &QUOTE) 
     1392                         
     1393                        newscripttext = mGetTextFromFile(me, tempSrcHFSPath) 
     1394                        if length(newscripttext) then 
     1395                          memref.scripttext = mGetTextFromFile(me, tempSrcHFSPath) 
     1396                        else 
     1397                          alert "Something seems wrong: the length of the new text is 0, nothing was changed now. If this was puprosely an empty text, please delete by hand." 
     1398                        end if 
     1399                         
     1400                      end if 
    14171401                       
    1418                       if char 1 of comm = "~" then put "$HOME" into char 1 of comm 
    1419                        
    1420                       mDoShellCmd(me, bbdiffpath & " --ignore-curly-quotes --ignore-spaces --wait --resume " &QUOTE& tempSrcPath &QUOTE&&QUOTE& comm &QUOTE) 
    1421                        
    1422                       memref.scripttext = mGetTextFromFile(me, tempSrcHFSPath) 
    14231402                       
    14241403                    end if 
Note: See TracChangeset for help on using the changeset viewer.