All pastes #996198 Raw Edit

Yajirobe / Windower Slashes Fix

public text v1 · immutable
#996198 ·published 2008-04-24 19:41 UTC
rendered paste body
alias slashes {
  var %dir = $?="Enter the path of your BASE Windower directory $crlf $+ (where launcher.exe is found)." 
  if (!$exists($+(%dir,$iif($right(%dir,1) !isin \/,\),launcher.exe))) { echo -a Windower directory not found/specified. | return }
  %dir = $+(%dir,$iif($right(%dir,1) !isin \/,/),scripts) 
  var %temp , %count = 0 , %i = 1 , %files = $findfile(%dir,*,0)
  while (%i <= %files) {
    var %j = 1 , %file = $findfile(%dir,*,%i)
    while ($read(%file,w,*\*,%j)) {
      if ($regsub($v1,/\G((?:[^\\]*|(?:\\\\)+)+)((?:\\)?)(?!\\)/g,\1\2\2,%temp) > 1) {
        write -l $+ $readn $qt(%file) %temp
        echo -s Line: $readn File: %file 
        inc %count
      }
      %j = $calc($readn + 1)
    }
    inc %i
  }
  echo -a %count replacements made.  Details printed on the Status Window.
}