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/svn_Utilities.ls

    r148 r151  
    9090           
    9191           
     92          tempSrcHFSPath = mGetTempFilePath(me, "temp_SVN_Diff_file1.ls") 
     93           
    9294          if isMac then 
    93              
    94             --------------------- 
    95             -- create a temporary file from scripttext: 
    96             --          tempSrcPath = mDoShellCmd(me, "mktemp -t temp_BBDiff_file1", 1) 
    97             --          tempSrcPath = tempSrcPath[1] 
    98             tempSrcPath = "/tmp/temp_BBEdit_file1.ls" 
    99              
    100             tempSrcHFSPath = mConvertUnix2Hfs(me, tempSrcPath) 
    101              
     95            tempSrcPath = mConvertHfs2unix(me, tempSrcHFSPath) 
    10296          else 
    103              
    104             tmpfolder = baSysFolder("temp") 
    105             tempSrcPath = tmpfolder & "temp_SVN_Diff_file1.ls" 
    106             tempSrcHFSPath = tempSrcPath 
     97            tempSrcPath = tempSrcHFSPath 
    10798          end if 
    10899           
     
    145136           
    146137           
    147            
    148            
    149           if isMac then 
    150              
    151             comm = mConvertHFS2Unix(me, thePath) 
    152              
    153             theResult = mDoShellCmd(me, bbdiffpath & " --ignore-curly-quotes --ignore-spaces --wait --resume " &QUOTE& tempSrcPath &QUOTE&&QUOTE& comm &QUOTE && "2>&1", RETURN, 0, 1) 
    154              
    155             -- since we used the --wait and the --resume switch, we will only come to this line AFTER the diff process in bbedit is finished 
    156              
    157             if count(theResult) > 0 then 
    158               if theResult[1] contains "no such file or directory" then 
    159                 put theResult[1] 
    160               else 
    161                 put "No differences found for member: " & memref.name && "(" & memref & ")" 
    162               end if 
    163               writeBack = 0 
    164                
    165             else 
    166                
    167               -------- now write the results of the BBEdit diff back into the script members 
    168               scrText = mGetTextFromFile(me, tempSrcHFSPath) 
    169                
    170               writeBack = 1 
    171                
    172                
    173             end if 
    174              
    175              
    176             ---------------------- windows 
    177           else 
    178              
    179              
    180             theResult = mDoShellCmd(me, QUOTE & bbdiffpath & QUOTE && QUOTE & tempSrcPath &QUOTE&&QUOTE& thePath &QUOTE, RETURN, 0, 0, 0) 
    181              
    182             -------- now write the results of the BBEdit diff back into the script members 
    183             scrText = mGetTextFromFile(me, tempSrcHFSPath) 
    184              
    185             writeBack = 1 
    186           end if 
    187            
    188            
    189           if writeBack = 1 then 
    190              
    191              
    192             if convertLineBreaksToUnix = 1 then 
    193               ------------------------------------------ trac subversion support works better with unix linebreaks... 
    194               if mCheckForXtra(me, "Pregex") = 1 then 
    195                  
    196                 scrTextLi = [scrText] 
    197                 ----------- always convert to mac linebreaks as director internally uses mac linebreaks 
    198                 --                if the platform contains "mac" then 
    199                 pregex_replace(scrTextLi, "\x0D?\x0A", "g", "\x0D") 
    200                 --                else 
    201                 --                  pregex_replace(scrTextLi, "\x0D([^\x0A])", "g", "\x0D\x0A\1") 
    202                 --                  pregex_replace(scrTextLi, "([^\x0D])\x0A", "g", "\1\x0D\x0A") 
    203                 --                end if 
    204                 scrText = scrTextLi[1] 
     138          if theResult <> 0 then 
     139             
     140             
     141             
     142             
     143            if isMac then 
     144               
     145              comm = mConvertHFS2Unix(me, thePath) 
     146               
     147              theResult = mDoShellCmd(me, bbdiffpath & " --ignore-curly-quotes --ignore-spaces --wait --resume " &QUOTE& tempSrcPath &QUOTE&&QUOTE& comm &QUOTE && "2>&1", RETURN, 0, 1) 
     148               
     149              -- since we used the --wait and the --resume switch, we will only come to this line AFTER the diff process in bbedit is finished 
     150               
     151              if count(theResult) > 0 then 
     152                if theResult[1] contains "no such file or directory" then 
     153                  put theResult[1] 
     154                else 
     155                  put "No differences found for member: " & memref.name && "(" & memref & ")" 
     156                end if 
     157                writeBack = 0 
    205158                 
    206159              else 
    207160                 
    208                 ----------- always convert to mac linebreaks as director internally uses mac linebreaks 
    209                 -- if the platform contains "mac" then 
     161                -------- now write the results of the BBEdit diff back into the script members 
     162                scrText = mGetTextFromFile(me, tempSrcHFSPath) 
    210163                 
    211                 -- first convert windows to mac 
    212                 fndStr = numToChar(13) & numToChar(10) 
    213                 offs = offset(fndStr, scrText) 
    214                 repeat while offs > 0 
    215                   put numToChar(13) into char offs to offs+1 of scrText 
    216                   offs = offset(fndStr, scrText) 
    217                 end repeat 
     164                writeBack = 1 
    218165                 
    219                 -- now convert unix to mac 
    220                 fndStr = numToChar(10) 
    221                 offs = offset(fndStr, scrText) 
    222                 repeat while offs > 0 
    223                   put numToChar(13) into char offs of scrText 
    224                   offs = offset(fndStr, scrText) 
    225                 end repeat 
    226                  
    227                 --                else 
    228                 --                   
    229                 --                  fndStr = numToChar(13) & numToChar(10) 
    230                 --                  offs = offset(fndStr, scrText) 
    231                 --                  repeat while offs > 0 
    232                 --                    put "ÀÀÀ" into char offs+1 of scrText 
    233                 --                    offs = offset(fndStr, scrText) 
    234                 --                  end repeat 
    235                 --                   
    236                 --                   
    237                 --                  fndStr = numToChar(10) 
    238                 --                  offs = offset(fndStr, scrText) 
    239                 --                  repeat while offs > 0 
    240                 --                    put "ÀÀÀ" into char offs of scrText 
    241                 --                    offs = offset(fndStr, scrText) 
    242                 --                  end repeat 
    243                 --                   
    244                 --                   
    245                 --                   
    246                 --                  fndStr = numToChar(13) & "ÀÀÀ" 
    247                 --                  offs = offset(fndStr, scrText) 
    248                 --                  repeat while offs > 0 
    249                 --                    put numToChar(13) & numToChar(10) into char offs to offs+3 of scrText 
    250                 --                    offs = offset(fndStr, scrText) 
    251                 --                  end repeat 
    252                 --                   
    253                 --                   
    254                 --                   
    255                 --                  fndStr = "ÀÀÀ" 
    256                 --                  offs = offset(fndStr, scrText) 
    257                 --                  repeat while offs > 0 
    258                 --                    put numToChar(13) & numToChar(10) into char offs to offs+2 of scrText 
    259                 --                    offs = offset(fndStr, scrText) 
    260                 --                  end repeat 
    261                 --                   
    262                 --                end if 
    263166                 
    264167              end if 
    265               ----------------------------------------- 
     168               
     169               
     170              ---------------------- windows 
     171            else 
     172               
     173               
     174              theResult = mDoShellCmd(me, QUOTE & bbdiffpath & QUOTE && QUOTE & tempSrcPath &QUOTE&&QUOTE& thePath &QUOTE, RETURN, 0, 0, 0) 
     175               
     176              -------- now write the results of the BBEdit diff back into the script members 
     177              scrText = mGetTextFromFile(me, tempSrcHFSPath) 
     178               
     179              writeBack = 1 
    266180            end if 
    267181             
    268182             
    269              
    270             case memtype of 
    271                  
    272                 ----------------------- 
    273               #script: 
    274                 memref.scripttext = scrText 
    275                  
    276                 ----------------------- 
    277               #field: 
    278                 memref.text = scrText 
    279                  
    280                 ----------------------- 
    281               #text: 
    282                 memref.html = scrText 
    283                  
    284                 ----------------------- 
    285               otherwise: 
    286                 memref.text = scrText 
    287                  
    288             end case 
     183            if writeBack = 1 then 
     184               
     185               
     186              if convertLineBreaksToUnix = 1 then 
     187                ------------------------------------------ trac subversion support works better with unix linebreaks... 
     188                if mCheckForXtra(me, "Pregex") = 1 then 
     189                   
     190                  scrTextLi = [scrText] 
     191                  ----------- always convert to mac linebreaks as director internally uses mac linebreaks 
     192                  pregex_replace(scrTextLi, "\x0D?\x0A", "g", "\x0D") 
     193                  scrText = scrTextLi[1] 
     194                   
     195                else 
     196                   
     197                  ----------- always convert to mac linebreaks as director internally uses mac linebreaks 
     198                  -- if the platform contains "mac" then 
     199                   
     200                  -- first convert windows to mac 
     201                  fndStr = numToChar(13) & numToChar(10) 
     202                  offs = offset(fndStr, scrText) 
     203                  repeat while offs > 0 
     204                    put numToChar(13) into char offs to offs+1 of scrText 
     205                    offs = offset(fndStr, scrText) 
     206                  end repeat 
     207                   
     208                  -- now convert unix to mac 
     209                  fndStr = numToChar(10) 
     210                  offs = offset(fndStr, scrText) 
     211                  repeat while offs > 0 
     212                    put numToChar(13) into char offs of scrText 
     213                    offs = offset(fndStr, scrText) 
     214                  end repeat 
     215                   
     216                   
     217                end if 
     218                ----------------------------------------- 
     219              end if 
     220               
     221               
     222               
     223              case memtype of 
     224                   
     225                  ----------------------- 
     226                #script: 
     227                  memref.scripttext = scrText 
     228                   
     229                  ----------------------- 
     230                #field: 
     231                  memref.text = scrText 
     232                   
     233                  ----------------------- 
     234                #text: 
     235                  memref.html = scrText 
     236                   
     237                  ----------------------- 
     238                otherwise: 
     239                  memref.text = scrText 
     240                   
     241              end case 
     242               
     243            end if 
    289244             
    290245          end if 
Note: See TracChangeset for help on using the changeset viewer.