提交 036002d8 authored 作者: Michael Jerris's avatar Michael Jerris

use different bat file names so multi proc systems can download more than one…

use different bat file names so multi proc systems can download more than one lib at a time without failing.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2414 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 97a1363c
...@@ -25,7 +25,7 @@ If Not IsObject(oStream) Then ...@@ -25,7 +25,7 @@ If Not IsObject(oStream) Then
Else Else
UseWgetEXE=false UseWgetEXE=false
End If End If
Randomize
Set objArgs = WScript.Arguments Set objArgs = WScript.Arguments
quote=Chr(34) quote=Chr(34)
ScriptDir=Left(WScript.ScriptFullName,Len(WScript.ScriptFullName)-Len(WScript.ScriptName)) ScriptDir=Left(WScript.ScriptFullName,Len(WScript.ScriptFullName)-Len(WScript.ScriptName))
...@@ -91,19 +91,20 @@ Sub GetWgetEXE(DestFolder) ...@@ -91,19 +91,20 @@ Sub GetWgetEXE(DestFolder)
End Sub End Sub
Sub UnCompress(Archive, DestFolder) Sub UnCompress(Archive, DestFolder)
batname = "tmp" & CStr(Int(10000*Rnd)) & ".bat"
wscript.echo("Extracting: " & Archive) wscript.echo("Extracting: " & Archive)
Set MyFile = fso.CreateTextFile(UtilsDir & "tmpcmd.Bat", True) Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)
MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Archive & quote & " -y -o" & quote & DestFolder & quote ) MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Archive & quote & " -y -o" & quote & DestFolder & quote )
MyFile.Close MyFile.Close
Set oExec = WshShell.Exec(UtilsDir & "tmpcmd.Bat") Set oExec = WshShell.Exec(UtilsDir & batname)
Do Do
WScript.Echo OExec.StdOut.ReadLine() WScript.Echo OExec.StdOut.ReadLine()
Loop While Not OExec.StdOut.atEndOfStream Loop While Not OExec.StdOut.atEndOfStream
If FSO.FileExists(Left(Archive, Len(Archive)-3))Then If FSO.FileExists(Left(Archive, Len(Archive)-3))Then
Set MyFile = fso.CreateTextFile(UtilsDir & "tmpcmd.Bat", True) Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)
MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Left(Archive, Len(Archive)-3) & quote & " -y -o" & quote & DestFolder & quote ) MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Left(Archive, Len(Archive)-3) & quote & " -y -o" & quote & DestFolder & quote )
MyFile.Close MyFile.Close
Set oExec = WshShell.Exec(UtilsDir & "tmpcmd.Bat") Set oExec = WshShell.Exec(UtilsDir & batname)
Do Do
WScript.Echo OExec.StdOut.ReadLine() WScript.Echo OExec.StdOut.ReadLine()
Loop While Not OExec.StdOut.atEndOfStream Loop While Not OExec.StdOut.atEndOfStream
...@@ -111,10 +112,10 @@ Sub UnCompress(Archive, DestFolder) ...@@ -111,10 +112,10 @@ Sub UnCompress(Archive, DestFolder)
FSO.DeleteFile Left(Archive, Len(Archive)-3) ,true FSO.DeleteFile Left(Archive, Len(Archive)-3) ,true
End If End If
If FSO.FileExists(Left(Archive, Len(Archive)-3) & "tar")Then If FSO.FileExists(Left(Archive, Len(Archive)-3) & "tar")Then
Set MyFile = fso.CreateTextFile(UtilsDir & "tmpcmd.Bat", True) Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)
MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Left(Archive, Len(Archive)-3) & "tar" & quote & " -y -o" & quote & DestFolder & quote ) MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Left(Archive, Len(Archive)-3) & "tar" & quote & " -y -o" & quote & DestFolder & quote )
MyFile.Close MyFile.Close
Set oExec = WshShell.Exec(UtilsDir & "tmpcmd.Bat") Set oExec = WshShell.Exec(UtilsDir & batname)
Do Do
WScript.Echo OExec.StdOut.ReadLine() WScript.Echo OExec.StdOut.ReadLine()
Loop While Not OExec.StdOut.atEndOfStream Loop While Not OExec.StdOut.atEndOfStream
...@@ -123,6 +124,9 @@ Sub UnCompress(Archive, DestFolder) ...@@ -123,6 +124,9 @@ Sub UnCompress(Archive, DestFolder)
End If End If
WScript.Sleep(500) WScript.Sleep(500)
If FSO.FileExists(UtilsDir & batname)Then
FSO.DeleteFile UtilsDir & batname, True
End If
End Sub End Sub
Sub Wget(URL, DestFolder) Sub Wget(URL, DestFolder)
...@@ -134,11 +138,12 @@ Sub Wget(URL, DestFolder) ...@@ -134,11 +138,12 @@ Sub Wget(URL, DestFolder)
Wscript.echo("Downloading: " & URL) Wscript.echo("Downloading: " & URL)
If UseWgetEXE Then If UseWgetEXE Then
Set MyFile = fso.CreateTextFile(UtilsDir & "tmpcmd.Bat", True) batname = "tmp" & CStr(Int(10000*Rnd)) & ".bat"
Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)
MyFile.WriteLine("@cd " & quote & DestFolder & quote) MyFile.WriteLine("@cd " & quote & DestFolder & quote)
MyFile.WriteLine("@" & quote & UtilsDir & "wget.exe" & quote & " " & URL) MyFile.WriteLine("@" & quote & UtilsDir & "wget.exe" & quote & " " & URL)
MyFile.Close MyFile.Close
Set oExec = WshShell.Exec(UtilsDir & "tmpcmd.Bat") Set oExec = WshShell.Exec(UtilsDir & batname)
Do Do
WScript.Echo OExec.StdOut.ReadLine() WScript.Echo OExec.StdOut.ReadLine()
Loop While Not OExec.StdOut.atEndOfStream Loop While Not OExec.StdOut.atEndOfStream
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论