[Freeswitch-svn] [commit] r12212 - in freeswitch/trunk/libs/spandsp/src: . msvc msvc/tiff

FreeSWITCH SVN mikej at freeswitch.org
Fri Feb 20 16:03:22 PST 2009


Author: mikej
Date: Fri Feb 20 18:03:22 2009
New Revision: 12212

Log:
Add auto-downloading libtiff to spandsp build

Added:
   freeswitch/trunk/libs/spandsp/src/msvc/Download_TIFF.2005.vcproj
   freeswitch/trunk/libs/spandsp/src/msvc/Download_TIFF.2008.vcproj
   freeswitch/trunk/libs/spandsp/src/msvc/tiff/
   freeswitch/trunk/libs/spandsp/src/msvc/tiff/cleancount
   freeswitch/trunk/libs/spandsp/src/msvc/util.vbs
Modified:
   freeswitch/trunk/libs/spandsp/src/Makefile.am
   freeswitch/trunk/libs/spandsp/src/libspandsp.2005.sln
   freeswitch/trunk/libs/spandsp/src/libspandsp.2008.sln
   freeswitch/trunk/libs/spandsp/src/msvc/   (props changed)

Modified: freeswitch/trunk/libs/spandsp/src/Makefile.am
==============================================================================
--- freeswitch/trunk/libs/spandsp/src/Makefile.am	(original)
+++ freeswitch/trunk/libs/spandsp/src/Makefile.am	Fri Feb 20 18:03:22 2009
@@ -44,6 +44,9 @@
              msvc/make_modem_filter.2008.vcproj \
              msvc/make_at_dictionary.2005.vcproj \
              msvc/make_modem_filter.2005.vcproj \
+             msvc/Download_TIFF.2008.vcproj \
+             msvc/Download_TIFF.2005.vcproj \
+             msvc/tiff/cleancout \
              msvc/msvcproj.head \
              msvc/msvcproj.foot \
              msvc/vc8proj.head \

Modified: freeswitch/trunk/libs/spandsp/src/libspandsp.2005.sln
==============================================================================
--- freeswitch/trunk/libs/spandsp/src/libspandsp.2005.sln	(original)
+++ freeswitch/trunk/libs/spandsp/src/libspandsp.2005.sln	Fri Feb 20 18:03:22 2009
@@ -11,25 +11,45 @@
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "libtiff.2005.vcproj", "{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}"
+	ProjectSection(ProjectDependencies) = postProject
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917} = {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download TIFF", "msvc\Download_TIFF.2005.vcproj", "{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		All|Win32 = All|Win32
 		Debug|Win32 = Debug|Win32
 		Release|Win32 = Release|Win32
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.Build.0 = All|Win32
 		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.ActiveCfg = All|Win32
 		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|Win32.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.Build.0 = All|Win32
 		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.ActiveCfg = All|Win32
 		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|Win32.ActiveCfg = All|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|Win32.ActiveCfg = Release|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|Win32.Build.0 = Release|Win32
 		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.Build.0 = Debug|Win32
 		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.ActiveCfg = Release|Win32
 		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.Build.0 = Release|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.ActiveCfg = Release|Win32
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.Build.0 = Release|Win32
 		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.ActiveCfg = Debug|Win32
 		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.Build.0 = Debug|Win32
 		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.ActiveCfg = Release|Win32
 		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.Build.0 = Release|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|Win32.ActiveCfg = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|Win32.Build.0 = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|Win32.ActiveCfg = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|Win32.Build.0 = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|Win32.ActiveCfg = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|Win32.Build.0 = All|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

Modified: freeswitch/trunk/libs/spandsp/src/libspandsp.2008.sln
==============================================================================
--- freeswitch/trunk/libs/spandsp/src/libspandsp.2008.sln	(original)
+++ freeswitch/trunk/libs/spandsp/src/libspandsp.2008.sln	Fri Feb 20 18:03:22 2009
@@ -11,25 +11,41 @@
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "libtiff.2008.vcproj", "{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}"
+	ProjectSection(ProjectDependencies) = postProject
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917} = {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download TIFF", "msvc\Download_TIFF.2008.vcproj", "{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		All|Win32 = All|Win32
+		All|x64 = All|x64
 		Debug|Win32 = Debug|Win32
 		Debug|x64 = Debug|x64
 		Release|Win32 = Release|Win32
 		Release|x64 = Release|x64
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.ActiveCfg = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.Build.0 = All|Win32
+		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|x64.ActiveCfg = All|Win32
 		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.ActiveCfg = All|Win32
 		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.Build.0 = All|Win32
 		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|x64.ActiveCfg = All|Win32
 		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|Win32.ActiveCfg = All|Win32
 		{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|x64.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.ActiveCfg = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.Build.0 = All|Win32
+		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|x64.ActiveCfg = All|Win32
 		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.ActiveCfg = All|Win32
 		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.Build.0 = All|Win32
 		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|x64.ActiveCfg = All|Win32
 		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|Win32.ActiveCfg = All|Win32
 		{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|x64.ActiveCfg = All|Win32
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|Win32.ActiveCfg = Release|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.ActiveCfg = Release|x64
+		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.Build.0 = Release|x64
 		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.Build.0 = Debug|Win32
 		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64.ActiveCfg = Debug|x64
@@ -38,6 +54,9 @@
 		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.Build.0 = Release|Win32
 		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.ActiveCfg = Release|x64
 		{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.Build.0 = Release|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.ActiveCfg = Release|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.ActiveCfg = Release|x64
+		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.Build.0 = Release|x64
 		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.ActiveCfg = Debug|Win32
 		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.Build.0 = Debug|Win32
 		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64.ActiveCfg = Debug|x64
@@ -46,6 +65,15 @@
 		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.Build.0 = Release|Win32
 		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.ActiveCfg = Release|x64
 		{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.Build.0 = Release|x64
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|Win32.ActiveCfg = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|Win32.Build.0 = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|x64.ActiveCfg = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|Win32.ActiveCfg = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|Win32.Build.0 = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|x64.ActiveCfg = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|Win32.ActiveCfg = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|Win32.Build.0 = All|Win32
+		{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|x64.ActiveCfg = All|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

Added: freeswitch/trunk/libs/spandsp/src/msvc/Download_TIFF.2005.vcproj
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/spandsp/src/msvc/Download_TIFF.2005.vcproj	Fri Feb 20 18:03:22 2009
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="Download TIFF"
+	ProjectGUID="{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}"
+	RootNamespace="Download TIFF"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="All|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\tiff\cleancount"
+			>
+			<FileConfiguration
+				Name="All|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Downloading Tiff."
+					CommandLine="if not exist &quot;$(ProjectDir)..\..\..\tiff-3.8.2&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/tiff-3.8.2.tar.gz &quot;$(ProjectDir)..\..\..&quot;&#x0D;&#x0A;"
+					Outputs="$(ProjectDir)..\..\..\tiff-3.8.2"
+				/>
+			</FileConfiguration>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Added: freeswitch/trunk/libs/spandsp/src/msvc/Download_TIFF.2008.vcproj
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/spandsp/src/msvc/Download_TIFF.2008.vcproj	Fri Feb 20 18:03:22 2009
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="Download TIFF"
+	ProjectGUID="{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}"
+	RootNamespace="Download TIFF"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="All|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\tiff\cleancount"
+			>
+			<FileConfiguration
+				Name="All|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Downloading Tiff."
+					CommandLine="if not exist &quot;$(ProjectDir)..\..\..\tiff-3.8.2&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/tiff-3.8.2.tar.gz &quot;$(ProjectDir)..\..\..&quot;&#x0D;&#x0A;"
+					Outputs="$(ProjectDir)..\..\..\tiff-3.8.2"
+				/>
+			</FileConfiguration>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Added: freeswitch/trunk/libs/spandsp/src/msvc/tiff/cleancount
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/spandsp/src/msvc/tiff/cleancount	Fri Feb 20 18:03:22 2009
@@ -0,0 +1 @@
+1
\ No newline at end of file

Added: freeswitch/trunk/libs/spandsp/src/msvc/util.vbs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/spandsp/src/msvc/util.vbs	Fri Feb 20 18:03:22 2009
@@ -0,0 +1,199 @@
+'
+' Contributor(s):
+' Michael Jerris <mike at jerris.com>
+' David A. Horner http://dave.thehorners.com
+'----------------------------------------------
+
+'On Error Resume Next
+' **************
+' Initialization
+' **************
+
+Set WshShell = CreateObject("WScript.Shell")
+Set FSO = CreateObject("Scripting.FileSystemObject")
+Set WshSysEnv = WshShell.Environment("SYSTEM")
+Set xml = CreateObject("Microsoft.XMLHTTP")
+Dim UseWgetEXE
+
+On Error Resume Next
+Set oStream = CreateObject("Adodb.Stream")
+On Error Goto 0
+
+If Not IsObject(oStream)  Then
+	wscript.echo("Failed to create Adodb.Stream, using alternative download method.")
+	UseWgetEXE=true
+Else
+	UseWgetEXE=false
+End If
+Randomize
+Set objArgs = WScript.Arguments
+quote=Chr(34)
+ScriptDir=Left(WScript.ScriptFullName,Len(WScript.ScriptFullName)-Len(WScript.ScriptName))
+UtilsDir=Showpath(ScriptDir)
+ToolsBase="http://svn.freeswitch.org/downloads/win32/"
+
+If UseWgetEXE Then
+	GetWgetEXE UtilsDir
+End If
+
+GetCompressionTools UtilsDir
+
+
+If objArgs.Count >=3 Then
+	Select Case objArgs(0)
+		Case "Get"		
+			Wget objArgs(1), Showpath(objArgs(2))
+		Case "GetUnzip"		
+			WgetUnCompress objArgs(1), Showpath(objArgs(2))
+	End Select
+End If
+
+
+' *******************
+' Utility Subroutines
+' *******************
+
+
+Sub WgetUnCompress(URL, DestFolder)
+	If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If
+	StartPos = InstrRev(URL, "/", -1, 1) 
+	strlength = Len(URL)
+	filename=Right(URL,strlength-StartPos)
+	NameEnd = InstrRev(filename, ".",-1, 1)
+	filestrlength = Len(filename)
+	filebase = Left(filename,NameEnd)
+	fileext = Right(filename, Len(filename) - NameEnd)
+	Wget URL, DestFolder
+	If fileext = "zip" Then
+		UnCompress Destfolder & filename, DestFolder & filebase
+	Else
+		UnCompress Destfolder & filename, DestFolder	
+	End If
+End Sub
+
+Sub GetCompressionTools(DestFolder)
+	Dim oExec
+	If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If
+	If Not FSO.FileExists(DestFolder & "7za.exe") Then 
+		If Not FSO.FileExists(DestFolder & "7za.tag") Then 
+			Set MyFile = fso.CreateTextFile(DestFolder & "7za.tag", True)
+			MyFile.WriteLine("This file marks a pending download for 7za.exe so we don't download it twice at the same time")
+			MyFile.Close
+				
+				Wget ToolsBase & "7za.exe", DestFolder
+			
+			FSO.DeleteFile DestFolder & "7za.tag" ,true 
+		Else
+			WScript.Sleep(5000)
+		End If	
+	End If	
+End Sub
+
+Sub GetWgetEXE(DestFolder)
+	Dim oExec
+	If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If
+	If Not FSO.FileExists(DestFolder & "wget.exe") Then 
+		Slow_Wget ToolsBase & "wget.exe", DestFolder
+	End If	
+End Sub
+
+Sub UnCompress(Archive, DestFolder)
+	batname = "tmp" & CStr(Int(10000*Rnd)) & ".bat"
+	wscript.echo("Extracting: " & Archive)
+	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 & 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 & 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 & batname)
+		Do
+			WScript.Echo OExec.StdOut.ReadLine()
+		Loop While Not OExec.StdOut.atEndOfStream
+		WScript.Sleep(500)
+		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 & 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 & batname)
+		Do
+			WScript.Echo OExec.StdOut.ReadLine()
+		Loop While Not OExec.StdOut.atEndOfStream
+		WScript.Sleep(500)
+		FSO.DeleteFile Left(Archive, Len(Archive)-3) & "tar",true 
+	End If
+	
+	WScript.Sleep(500)
+	If FSO.FileExists(UtilsDir & batname)Then  
+		FSO.DeleteFile UtilsDir & batname, True
+	End If
+End Sub
+
+Sub Wget(URL, DestFolder)
+	StartPos = InstrRev(URL, "/", -1, 1)   
+	strlength = Len(URL)
+	filename=Right(URL,strlength-StartPos)
+	If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If
+
+	Wscript.echo("Downloading: " & URL)
+	
+If UseWgetEXE Then
+	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 & batname)
+	Do
+		WScript.Echo OExec.StdOut.ReadLine()
+	Loop While Not OExec.StdOut.atEndOfStream
+
+Else
+	xml.Open "GET", URL, False
+	xml.Send
+	
+	Const adTypeBinary = 1
+	Const adSaveCreateOverWrite = 2
+	Const adSaveCreateNotExist = 1 
+
+	oStream.type = adTypeBinary
+	oStream.open
+	oStream.write xml.responseBody
+	oStream.savetofile DestFolder & filename, adSaveCreateOverWrite
+	oStream.close
+End If
+
+End Sub
+
+Sub Slow_Wget(URL, DestFolder)
+	StartPos = InstrRev(URL, "/", -1, 1)   
+	strlength = Len(URL)
+	filename=Right(URL,strlength-StartPos)
+	If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If
+
+	Wscript.echo("Downloading: " & URL)
+	xml.Open "GET", URL, False
+	xml.Send
+	
+	const ForReading = 1 , ForWriting = 2 , ForAppending = 8 
+	Set MyFile = fso.OpenTextFile(DestFolder & filename ,ForWriting, True)
+	For i = 1 to lenb(xml.responseBody)
+	 MyFile.write Chr(Ascb(midb(xml.responseBody,i,1)))
+	Next
+	MyFile.Close()
+
+End Sub
+
+Function Showpath(folderspec)
+	Set f = FSO.GetFolder(folderspec)
+	showpath = f.path & "\"
+End Function
+
+



More information about the Freeswitch-svn mailing list