[Freeswitch-svn] [commit] r2414 - freeswitch/trunk/libs/win32

Freeswitch SVN mikej at freeswitch.org
Sun Aug 27 22:01:41 EDT 2006


Author: mikej
Date: Sun Aug 27 22:01:41 2006
New Revision: 2414

Modified:
   freeswitch/trunk/libs/win32/util.vbs

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

Modified: freeswitch/trunk/libs/win32/util.vbs
==============================================================================
--- freeswitch/trunk/libs/win32/util.vbs	(original)
+++ freeswitch/trunk/libs/win32/util.vbs	Sun Aug 27 22:01:41 2006
@@ -25,7 +25,7 @@
 Else
 	UseWgetEXE=false
 End If
-
+Randomize
 Set objArgs = WScript.Arguments
 quote=Chr(34)
 ScriptDir=Left(WScript.ScriptFullName,Len(WScript.ScriptFullName)-Len(WScript.ScriptName))
@@ -91,19 +91,20 @@
 End Sub
 
 Sub UnCompress(Archive, DestFolder)
+	batname = "tmp" & CStr(Int(10000*Rnd)) & ".bat"
 	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.Close
-	Set oExec = WshShell.Exec(UtilsDir & "tmpcmd.Bat")
+	Set oExec = WshShell.Exec(UtilsDir & batname)
 	Do
 		WScript.Echo OExec.StdOut.ReadLine()
 	Loop While Not OExec.StdOut.atEndOfStream
 	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.Close
-		Set oExec = WshShell.Exec(UtilsDir & "tmpcmd.Bat")
+		Set oExec = WshShell.Exec(UtilsDir & batname)
 		Do
 			WScript.Echo OExec.StdOut.ReadLine()
 		Loop While Not OExec.StdOut.atEndOfStream
@@ -111,10 +112,10 @@
 		FSO.DeleteFile Left(Archive, Len(Archive)-3) ,true 
 	End If
 	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.Close
-		Set oExec = WshShell.Exec(UtilsDir & "tmpcmd.Bat")
+		Set oExec = WshShell.Exec(UtilsDir & batname)
 		Do
 			WScript.Echo OExec.StdOut.ReadLine()
 		Loop While Not OExec.StdOut.atEndOfStream
@@ -123,6 +124,9 @@
 	End If
 	
 	WScript.Sleep(500)
+	If FSO.FileExists(UtilsDir & batname)Then  
+		FSO.DeleteFile UtilsDir & batname, True
+	End If
 End Sub
 
 Sub Wget(URL, DestFolder)
@@ -134,11 +138,12 @@
 	Wscript.echo("Downloading: " & URL)
 	
 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("@" & quote & UtilsDir & "wget.exe" & quote & " " & URL)
 	MyFile.Close
-	Set oExec = WshShell.Exec(UtilsDir & "tmpcmd.Bat")
+	Set oExec = WshShell.Exec(UtilsDir & batname)
 	Do
 		WScript.Echo OExec.StdOut.ReadLine()
 	Loop While Not OExec.StdOut.atEndOfStream



More information about the Freeswitch-svn mailing list