Changeset 148 for trunk/lingosource/castlib1/alexUtilities.ls
- Timestamp:
- 02/18/08 05:09:49 (4 years ago)
- File:
-
- 1 edited
-
trunk/lingosource/castlib1/alexUtilities.ls (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lingosource/castlib1/alexUtilities.ls
r136 r148 2427 2427 2428 2428 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2429 ------------------- subversion support works better with unix linebreaks... 2430 2431 on mConvertLineBreaksToUnix me, st 2432 2433 if mCheckForXtra(me, "Pregex") = 1 then 2434 scrTextLi = [st] 2435 pregex_replace(scrTextLi, "\x0D\x0A?", "g", "\x0A") 2436 return scrTextLi[1] 2437 else 2438 fndStr = numToChar(13) & numToChar(10) 2439 offs = offset(fndStr, st) 2440 repeat while offs > 0 2441 delete char offs of st 2442 offs = offset(fndStr, st) 2443 end repeat 2444 2445 fndStr = numToChar(13) 2446 offs = offset(fndStr, st) 2447 repeat while offs > 0 2448 put numToChar(10) into char offs of st 2449 offs = offset(fndStr, st) 2450 end repeat 2451 2452 end if 2453 2454 return st 2455 2456 end 2457 2458 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2459 ----------- always convert to mac linebreaks for scripts as director internally uses mac linebreaks 2460 2461 on mConvertLineBreaksToMac me, scrText 2462 2463 if mCheckForXtra(me, "Pregex") = 1 then 2464 2465 scrTextLi = [scrText] 2466 pregex_replace(scrTextLi, "\x0D?\x0A", "g", "\x0D") 2467 return scrTextLi[1] 2468 2469 else 2470 2471 -- first convert windows to mac 2472 fndStr = numToChar(13) & numToChar(10) 2473 offs = offset(fndStr, scrText) 2474 repeat while offs > 0 2475 put numToChar(13) into char offs to offs+1 of scrText 2476 offs = offset(fndStr, scrText) 2477 end repeat 2478 2479 -- now convert unix to mac 2480 fndStr = numToChar(10) 2481 offs = offset(fndStr, scrText) 2482 repeat while offs > 0 2483 put numToChar(13) into char offs of scrText 2484 offs = offset(fndStr, scrText) 2485 end repeat 2486 2487 end if 2488 ----------------------------------------- 2489 2490 return scrText 2491 2492 end 2493 2494 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2495 2496 on mGetTempFilePath me, theName 2497 2498 if mCheckForXtra(me, "BudAPI") then 2499 if the platform contains "mac" then 2500 2501 resetUNames = 0 2502 if baSysFolder("prefs") starts "/" then 2503 baReturnUnixNames(0) 2504 resetUNames = 1 2505 end if 2506 tempSrcHFSPath = basysfolder("temp") & theName 2507 if resetUNames = 1 then baReturnUnixNames(1) 2508 return tempSrcHFSPath 2509 2510 else 2511 tmpfolder = baSysFolder("temp") 2512 return tmpfolder & theName 2513 end if 2514 2515 else 2516 if the platform contains "mac" then 2517 2518 tempSrcPath = "/tmp/" & theName 2519 2520 return mConvertUnix2Hfs(me, tempSrcPath) 2521 2522 else 2523 tmpfolder = "C:\WINDOWS\TEMP\" 2524 return tmpfolder & theName 2525 end if 2526 2527 end if 2528 2529 end 2530 2531 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2429 2532 on _______________GLOSSARY_ITEMS me 2430 2533 end … … 2591 2694 2592 2695 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2696 on _______________EXTERNAL_PATHS me 2697 end 2698 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2699 2700 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2701 2702 on mGetExternalScriptEditor me, externalEditors 2703 2704 if mCheckForXtra(me, "budapi") <> 1 then 2705 alert "You need the buddyApi xtra for this operation" 2706 exit 2707 end if 2708 2709 savePrefs = 0 2710 if ilk(externalEditors) <> #proplist then 2711 externalEditors = value(getPref("handlerMenu_externalEditors.txt")) 2712 if ilk(externalEditors) <> #proplist then externalEditors = [:] 2713 savePrefs = 1 2714 end if 2715 2716 if the shiftdown then 2717 externalScripteditor = "" 2718 savePrefs = 1 2719 else 2720 externalScripteditor = string(externalEditors.getaprop(#externalScripteditor)) 2721 if baFileExists(externalScripteditor) <> 1 then externalScripteditor = "" 2722 end if 2723 2724 if length(externalScripteditor) < 1 then 2725 2726 alert "Please select an external script editor." 2727 externalScripteditor = mGetFilePathFromUser(me) 2728 if length(externalScripteditor) < 1 then return "" 2729 2730 end if 2731 2732 if baFileExists(externalScripteditor) <> 1 then 2733 alert "The path to the external script editor seems to have changed. Please try again in order to search the path." 2734 externalScripteditor = "" 2735 end if 2736 2737 externalEditors.setaprop(#externalScripteditor, externalScripteditor) 2738 2739 if savePrefs = 1 then setPref("handlerMenu_externalEditors.txt", string(externalEditors)) 2740 2741 return externalScripteditor 2742 2743 end 2744 2745 2746 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2747 2748 on mGetSVNDiffBinaryPath me, workingCopies 2749 2750 if (mCheckForXtra(me, "budapi") + (mCheckForXtra(me, "Shell") + mCheckForXtra(me, "ff_shell"))) < 2 then 2751 alert "You need the shell xtra and the buddyApi xtra in order to proceed" 2752 return "" 2753 end if 2754 2755 savePrefs = 0 2756 if ilk(workingCopies) <> #proplist then 2757 workingCopies = value(getPref("svn_workingCopies_paths.txt")) 2758 if ilk(workingCopies) <> #proplist then workingCopies = [:] 2759 savePrefs = 1 2760 end if 2761 2762 2763 svnBinary = string(workingCopies.getaprop(#svnDiffBinary)) 2764 2765 2766 if baFileExists(svnBinary) <> 1 then svnBinary = "" 2767 2768 2769 if length(svnBinary) < 1 then 2770 2771 alert "There is not yet an application specified to handle file diffs. Please select the applivcation you want to use, e.g. TortoiseMerge in your Tortoise folder, if you are using Tortoise." 2772 svnBinary = mGetFilePathFromUser(me) 2773 if length(svnBinary) < 1 then return "" 2774 2775 end if 2776 2777 if baFileExists(svnBinary) <> 1 then 2778 alert "The path to the svn diff binary seems to have changed. Please try again in order to search the path." 2779 svnBinary = "" 2780 end if 2781 2782 2783 2784 workingCopies.setaprop(#svnDiffBinary, svnBinary) 2785 2786 if savePrefs = 1 then setPref("svn_workingCopies_paths.txt", string(workingCopies)) 2787 2788 return svnBinary 2789 2790 end 2791 2792 2793 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2593 2794 on _______________HELPER_HANDLER me 2594 2795 end 2595 2796 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2596 2597 2797 2598 2798 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Note: See TracChangeset
for help on using the changeset viewer.
