提交 5c37e18c authored 作者: Michael Jerris's avatar Michael Jerris

Scripts for MSVC\Windows to download and compile dependency libs. Still to do,…

Scripts for MSVC\Windows to download and compile dependency libs.  Still to do, consolidate scripts into 1 vbscript and probably a bat file stub to launch the vbscript.

git-svn-id: http://svn.freeswitch.org/svn/local/src/freeswitch@23 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 b91edd01
REM @echo off
ECHO ****************************************************************
ECHO ************** VARIABLE SETUP *****************
ECHO ****************************************************************
for /f %%i in ('cscript /Nologo .\tools\Fulldir.vbs .\..\..\..\..') DO SET BASEDIR=%%i
set UTILSDIR=%BASEDIR%\src\freeswitch\platform\vsnet\Tools
set INCLUDEDIR=%BASEDIR%\include
set LIBSRCDIR=%BASEDIR%\src
set DEBUGLIBBINDIR=%BASEDIR%\debuglib
set WGET=cscript %UTILSDIR%\wget.vbs
set PATCHURL=http://www.jerris.com/
SET PATCHTAR=patch.tar.gz
set TAR=%UTILSDIR%\tar.exe
set TARURL=http://users.pandora.be/larc/download/windows_management/tar.exe
set GUNZIP=%UTILSDIR%\gunzip.exe
set GUNZIPURL=http://users.pandora.be/larc/download/windows_management/gunzip.exe
set UNIX2DOS=%UTILSDIR%\unix2dos.vbs
set PATCH=%UTILSDIR%\PATCH.exe
set APRDIR=apr-1.2.2
set APRTAR=%APRDIR%.tar.gz
set APRURL=ftp://ftp.wayne.edu/apache/apr/
set APRDESTDIR=apr
set CCRTPDIR=ccrtp-1.3.5
set CCRTPTAR=%CCRTPDIR%.tar.gz
set CCRTPURL=ftp://ftp.gnu.org/pub/gnu/ccrtp/
set CCRTPDESTDIR=ccrtp
set CCPPDIR=commoncpp2-1.3.21
set CCPPTAR=%CCPPDIR%.tar.gz
set CCPPURL=ftp://ftp.gnu.org/gnu/commoncpp/
set CCPPDESTDIR=commoncpp2
set EXOSIPDIR=libeXosip-0.9.0
set EXOSIPTAR=%EXOSIPDIR%.tar.gz
set EXOSIPURL=http://www.antisip.com/download/
set EXOSIPDESTDIR=eXosip
set OSIPDIR=libosip2-2.2.1
set OSIPTAR=%OSIPDIR%.tar.gz
set OSIPURL=http://www.antisip.com/download/
set OSIPDESTDIR=libosip2-2.2.0
IF NOT EXIST %INCLUDEDIR% md %INCLUDEDIR%
IF NOT EXIST %DEBUGLIBBINDIR% md %DEBUGLIBBINDIR%
IF NOT EXIST %LIBSRCDIR% md %LIBSRCDIR%
cd %LIBSRCDIR%
ECHO ****************************************************************
ECHO ************** DOWNLOADS *****************
ECHO ****************************************************************
IF NOT EXIST %TAR% %WGET% %TARURL% %UTILSDIR%
IF NOT EXIST %GUNZIP% %WGET% %GUNZIPURL% %UTILSDIR%
cd %UTILSDIR%
IF NOT EXIST %UTILSDIR%\%PATCHTAR% IF NOT EXIST %PATCH% %WGET% %PATCHURL%%PATCHTAR% %UTILSDIR% & %GUNZIP% < %UTILSDIR%\%PATCHTAR% | %TAR% xvf - & del %PATCHTAR%
cd %LIBSRCDIR%
IF NOT EXIST %APRTAR% IF NOT EXIST %APRDESTDIR% %WGET% %APRURL%%APRTAR% & %GUNZIP% < %APRTAR% | %TAR% xvf - & ren %APRDIR% %APRDESTDIR% & del %APRTAR%
IF NOT EXIST %CCRTPTAR% IF NOT EXIST %CCRTPDESTDIR% %WGET% %CCRTPURL%%CCRTPTAR% & %GUNZIP% < %CCRTPTAR% | %TAR% xvf - & ren %CCRTPDIR% %CCRTPDESTDIR% & del %CCRTPTAR%
IF NOT EXIST %CCPPTAR% IF NOT EXIST %CCPPDESTDIR% %WGET% %CCPPURL%%CCPPTAR% & %GUNZIP% < %CCPPTAR% | %TAR% xvf - & ren %CCPPDIR% %CCPPDESTDIR% & del %CCPPTAR%
IF NOT EXIST %EXOSIPTAR% IF NOT EXIST %EXOSIPDESTDIR% %WGET% %EXOSIPURL%%EXOSIPTAR% & %GUNZIP% < %EXOSIPTAR% | %TAR% xvf - & ren %EXOSIPDIR% %EXOSIPDESTDIR% & del %EXOSIPTAR%
IF NOT EXIST %OSIPTAR% IF NOT EXIST %OSIPDESTDIR% %WGET% %OSIPURL%%OSIPTAR% & %GUNZIP% < %OSIPTAR% | %TAR% xvf - & ren %OSIPDIR% %OSIPDESTDIR% & del %OSIPTAR%
ECHO ****************************************************************
ECHO ************** VS Version Detection *****************
ECHO ****************************************************************
IF EXIST "%VS80COMNTOOLS%..\IDE\devenv.exe" GOTO VS8
IF EXIST "%VS71COMNTOOLS%..\IDE\devenv.exe" GOTO VS7
echo no Visual Studio .net 2003 or greater found. I don't know how to autobuild projects. Please manually build libs.
GOTO END
:VS8
set DEVENV="%VS80COMNTOOLS%..\IDE\devenv"
IF NOT EXIST %UTILSDIR%\upgrade.vbs copy %UTILSDIR%\upgrade8.vbs %UTILSDIR%\upgrade.vbs
call "%VS80COMNTOOLS%vsvars32.bat"
GOTO NEXT
:VS7
set DEVENV="%VS71COMNTOOLS%..\IDE\devenv"
IF NOT EXIST %UTILSDIR%\upgrade.vbs copy %UTILSDIR%\upgrade7.vbs %UTILSDIR%\upgrade.vbs
call "%VS71COMNTOOLS%vsvars32.bat"
:NEXT
ECHO ****************************************************************
ECHO ************** APR BUILD *****************
ECHO ****************************************************************
cd %APRDESTDIR%
IF NOT EXIST %INCLUDEDIR%\apr.h copy %LIBSRCDIR%\%APRDESTDIR%\include\*.h %INCLUDEDIR%
IF NOT EXIST %INCLUDEDIR%\apr.h copy %LIBSRCDIR%\%APRDESTDIR%\include\apr.hw %INCLUDEDIR%\apr.h
IF NOT EXIST libapr.vcproj %UNIX2DOS% libapr.dsp
IF NOT EXIST libapr.vcproj cscript %UTILSDIR%\upgrade.vbs libapr.dsp libapr.vcproj
%DEVENV% libapr.vcproj /build Debug
REM %DEVENV% libapr.vcproj /build Release
copy %LIBSRCDIR%\%APRDESTDIR%\debug\*.lib %DEBUGLIBBINDIR%
copy %LIBSRCDIR%\%APRDESTDIR%\debug\*.dll %DEBUGLIBBINDIR%
ECHO ****************************************************************
ECHO ************** CCRTP BUILD *****************
ECHO ****************************************************************
cd %LIBSRCDIR%\%CCPPDESTDIR%
cd src
IF NOT EXIST patched.tag copy %UTILSDIR%\commoncpp2005.diff
IF EXIST commoncpp2005.diff %PATCH% -u -i commoncpp2005.diff
IF EXIST commoncpp2005.diff ren commoncpp2005.diff patched.tag
IF NOT EXIST "%INCLUDEDIR%\cc++" copy "%LIBSRCDIR%\%CCPPDESTDIR%\src\*.h" "%INCLUDEDIR%"
IF NOT EXIST "%INCLUDEDIR%\ccrtp" copy "%LIBSRCDIR%\ccrtp4c\src\*.h" "%INCLUDEDIR%"
IF NOT EXIST "%INCLUDEDIR%\cc++" md "%INCLUDEDIR%\cc++"
IF NOT EXIST "%INCLUDEDIR%\ccrtp" md "%INCLUDEDIR%\ccrtp"
IF NOT EXIST "%INCLUDEDIR%\ccrtp\base.h" copy "%LIBSRCDIR%\%CCRTPDESTDIR%\src\ccrtp\*.h" "%INCLUDEDIR%\ccrtp"
IF NOT EXIST "%INCLUDEDIR%\cc++\pointer.h" copy "%LIBSRCDIR%\%CCPPDESTDIR%\src\template\*.h" "%INCLUDEDIR%\cc++"
IF NOT EXIST "%INCLUDEDIR%\cc++\unix.h" copy "%LIBSRCDIR%\%CCPPDESTDIR%\src\include\cc++\*.h" "%INCLUDEDIR%\cc++"
IF NOT EXIST "%INCLUDEDIR%\cc++\config.h" copy "%LIBSRCDIR%\%CCPPDESTDIR%\src\w32\cc++\*.h" "%INCLUDEDIR%\cc++"
IF NOT EXIST "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\include\cc++" md "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\include" & md "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\include\cc++"
IF NOT EXIST "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\include\cc++\unix.h" copy "%LIBSRCDIR%\%CCPPDESTDIR%\w32\cc++\*.h" "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\include\cc++"
IF NOT EXIST "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\include\cc++\unix.h" copy "%LIBSRCDIR%\%CCPPDESTDIR%\w32\cc++\*.h" "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\include"
IF NOT EXIST "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\include\cc++\unix.h" copy "%LIBSRCDIR%\%CCPPDESTDIR%\include\cc++\*.h" "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\include\cc++\"
IF NOT EXIST "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\template\cc++" md "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\template" & md "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\template\cc++"
IF NOT EXIST "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\template\cc++\pointer.h" copy "%LIBSRCDIR%\%CCPPDESTDIR%\template\*.h" "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\template\cc++\"
IF NOT EXIST "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\src" md "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\src"
IF NOT EXIST "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\src\unix.cpp" copy "%LIBSRCDIR%\%CCPPDESTDIR%\src\*.*" "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\src\"
del "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\common\*.dsp"
copy "%LIBSRCDIR%\%CCPPDESTDIR%\w32\*.dsp" "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\common\"
copy "%UTILSDIR%\ccrtp1.sln" "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\msvcpp\"
IF NOT EXIST "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\common\ccgnu2.vcproj" cscript %UTILSDIR%\upgrade.vbs %LIBSRCDIR%\%CCRTPDESTDIR%\w32\common\ccgnu2.dsp %LIBSRCDIR%\%CCRTPDESTDIR%\w32\common\ccgnu2.vcproj
IF NOT EXIST "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\common\ccext2.vcproj" cscript %UTILSDIR%\upgrade.vbs %LIBSRCDIR%\%CCRTPDESTDIR%\w32\common\ccext2.dsp %LIBSRCDIR%\%CCRTPDESTDIR%\w32\common\ccext2.vcproj
IF NOT EXIST "%LIBSRCDIR%\%CCRTPDESTDIR%\w32\msvcpp\ccrtp1.vcproj" cscript %UTILSDIR%\upgrade.vbs %LIBSRCDIR%\%CCRTPDESTDIR%\w32\msvcpp\ccrtp1.dsp %LIBSRCDIR%\%CCRTPDESTDIR%\w32\msvcpp\ccrtp1.vcproj
cd %LIBSRCDIR%\%CCRTPDESTDIR%\w32\common
%DEVENV% ccgnu2.vcproj /build Debug /project ccgnu2
REM %DEVENV% ccgnu2.vcproj /build Release /project ccgnu2
%DEVENV% ccext2.vcproj /build Debug /project ccext2
REM %DEVENV% ccext2.vcproj /build Release /project ccext2
cd %LIBSRCDIR%\%CCRTPDESTDIR%\w32\msvcpp
%DEVENV% ccrtp1.vcproj /build Debug /project ccrtp1
REM %DEVENV% ccrtp1.vcproj /build Release /project ccrtp1
cd %LIBSRCDIR%
copy %LIBSRCDIR%\%CCRTPDESTDIR%\w32\common\debug\*.lib %DEBUGLIBBINDIR%
copy %LIBSRCDIR%\%CCRTPDESTDIR%\w32\common\debug\*.dll %DEBUGLIBBINDIR%
copy %LIBSRCDIR%\%CCRTPDESTDIR%\w32\msvcpp\debug\*.lib %DEBUGLIBBINDIR%
copy %LIBSRCDIR%\%CCRTPDESTDIR%\w32\msvcpp\debug\*.dll %DEBUGLIBBINDIR%
ECHO ****************************************************************
ECHO ************** OSIP BUILD *****************
ECHO ****************************************************************
IF NOT EXIST %INCLUDEDIR%\osip2 md %INCLUDEDIR%\osip2
IF NOT EXIST %INCLUDEDIR%\osipparser2 md %INCLUDEDIR%\osipparser2
IF NOT EXIST %INCLUDEDIR%\osip2\osip.h copy %LIBSRCDIR%\%OSIPDESTDIR%\include\osip2\*.h %INCLUDEDIR%\osip2
IF NOT EXIST %INCLUDEDIR%\osipparser2\osip_parser.h copy %LIBSRCDIR%\%OSIPDESTDIR%\include\osipparser2\*.h %INCLUDEDIR%\osipparser2
%DEVENV% %LIBSRCDIR%\%OSIPDESTDIR%\platform\vsnet\osip.sln /Upgrade
%DEVENV% %LIBSRCDIR%\%OSIPDESTDIR%\platform\vsnet\osip.sln /build Debug
REM %DEVENV% %LIBSRCDIR%\%OSIPDESTDIR%\platform\vsnet\osip.sln /build Release
copy %LIBSRCDIR%\%OSIPDESTDIR%\platform\vsnet\debug\*.lib %DEBUGLIBBINDIR%
ECHO ****************************************************************
ECHO ************** EXOSIP BUILD *****************
ECHO ****************************************************************
IF NOT EXIST "%INCLUDEDIR%\eXosip" md "%INCLUDEDIR%\eXosip"
IF NOT EXIST %INCLUDEDIR%\eXosip copy "%LIBSRCDIR%\%EXOSIPDESTDIR%\include\eXosip\*.h" "%INCLUDEDIR%\eXosip"
%UNIX2DOS% %LIBSRCDIR%\%EXOSIPDESTDIR%\platform\windows\eXosip.vcproj
%DEVENV% %LIBSRCDIR%\%EXOSIPDESTDIR%\platform\windows\eXosip.vcproj /Upgrade
%DEVENV% %LIBSRCDIR%\%EXOSIPDESTDIR%\platform\windows\eXosip.vcproj /build Debug
REM %DEVENV% %LIBSRCDIR%\%EXOSIPDESTDIR%\platform\windows\eXosip.vcproj /build Release
copy %LIBSRCDIR%\%EXOSIPDESTDIR%\platform\windows\debug\*.lib %DEBUGLIBBINDIR%
:END
cd %BASEDIR%
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objArgs = WScript.Arguments
'system, user, or process
wscript.echo Showpath(objargs(0))
Function Showpath(folderspec)
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec)
showpath = f.path
End Function
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ccext2", "..\common\ccext2.vcproj", "{BDCDCE59-1DBA-48A9-A6F4-00C6E8528A29}"
ProjectSection(ProjectDependencies) = postProject
{38CADFB3-E363-4B5C-9BA3-F77321211B9D} = {38CADFB3-E363-4B5C-9BA3-F77321211B9D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ccgnu2", "..\common\ccgnu2.vcproj", "{38CADFB3-E363-4B5C-9BA3-F77321211B9D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ccrtp1", "ccrtp1.vcproj", "{3C266BF0-3EDE-4A83-8D10-E254456F7CDF}"
ProjectSection(ProjectDependencies) = postProject
{38CADFB3-E363-4B5C-9BA3-F77321211B9D} = {38CADFB3-E363-4B5C-9BA3-F77321211B9D}
{BDCDCE59-1DBA-48A9-A6F4-00C6E8528A29} = {BDCDCE59-1DBA-48A9-A6F4-00C6E8528A29}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BDCDCE59-1DBA-48A9-A6F4-00C6E8528A29}.Debug|Win32.ActiveCfg = Debug|Win32
{BDCDCE59-1DBA-48A9-A6F4-00C6E8528A29}.Debug|Win32.Build.0 = Debug|Win32
{BDCDCE59-1DBA-48A9-A6F4-00C6E8528A29}.Release|Win32.ActiveCfg = Release|Win32
{BDCDCE59-1DBA-48A9-A6F4-00C6E8528A29}.Release|Win32.Build.0 = Release|Win32
{38CADFB3-E363-4B5C-9BA3-F77321211B9D}.Debug|Win32.ActiveCfg = Debug|Win32
{38CADFB3-E363-4B5C-9BA3-F77321211B9D}.Debug|Win32.Build.0 = Debug|Win32
{38CADFB3-E363-4B5C-9BA3-F77321211B9D}.Release|Win32.ActiveCfg = Release|Win32
{38CADFB3-E363-4B5C-9BA3-F77321211B9D}.Release|Win32.Build.0 = Release|Win32
{3C266BF0-3EDE-4A83-8D10-E254456F7CDF}.Debug|Win32.ActiveCfg = Debug|Win32
{3C266BF0-3EDE-4A83-8D10-E254456F7CDF}.Debug|Win32.Build.0 = Debug|Win32
{3C266BF0-3EDE-4A83-8D10-E254456F7CDF}.Release|Win32.ActiveCfg = Release|Win32
{3C266BF0-3EDE-4A83-8D10-E254456F7CDF}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
--- thread.cpp.bak 2005-07-19 08:16:10.000000000 -0400
+++ thread.cpp 2005-11-14 13:04:59.200854500 -0500
@@ -1758,14 +1758,16 @@
int SysTime::getTimeOfDay(struct timeval *tp)
{
struct timeval temp;
- int ret(0);
+ time_t now;
+ int ret(0);
lock();
#ifdef WIN32
// We could use _ftime(), but it is not available on WinCE.
// (WinCE also lacks time.h)
// Note also that the average error of _ftime is around 20 ms :)
- time(&temp.tv_sec);
+ time(&now);
+ temp.tv_sec = (long) now;
temp.tv_usec = (GetTickCount() % 1000) * 1000;
memcpy(tp, &temp, sizeof(struct timeval));
#else
--- lockfile.cpp.bak 2005-04-23 19:08:21.000000000 -0400
+++ lockfile.cpp 2005-11-14 13:05:56.305244100 -0500
@@ -68,7 +68,7 @@
bool Lockfile::lock(const char *name)
{
char mname[65];
- char *ext = strrchr(name, '/');
+ char *ext = (char *) strrchr(name, '/');
if(ext)
name = ++ext;
--- socket.cpp.bak 2005-10-09 09:12:35.000000000 -0400
+++ socket.cpp 2005-11-14 13:05:32.710375300 -0500
@@ -1330,7 +1330,7 @@
return;
}
-#if defined(SO_REUSEADDR) && !defined(WIN32)
+#if defined(SO_REUSEADDR) //&& !defined(WIN32)
int opt = 1;
setsockopt(so, SOL_SOCKET, SO_REUSEADDR, (char *)&opt,
(socklen_t)sizeof(opt));
Const OpenAsASCII = 0 ' Opens the file as ASCII (TristateFalse)
Const OpenAsUnicode = -1 ' Opens the file as Unicode (TristateTrue)
Const OpenAsDefault = -2 ' Opens the file using the system default
Const OverwriteIfExist = -1
Const FailIfNotExist = 0
Const ForReading = 1
Set objArgs = WScript.Arguments
' path to original log file
sFileName = objargs(0)
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set fOrgFile = oFSO.OpenTextFile(sFileName, ForReading, FailIfNotExist, OpenAsASCII)
sText = fOrgFile.ReadAll
fOrgFile.Close
sText = Replace(sText, vbLf, vbCrLf)
Set fNewFile = oFSO.CreateTextFile(sFileName, OverwriteIfExist, OpenAsASCII)
fNewFile.WriteLine sText
fNewFile.Close
Set vcProj = CreateObject("VisualStudio.VCProjectEngine.7.1")
Set objFile = Createobject("Scripting.FileSystemObject")
Set objArgs = WScript.Arguments
'// check the arguments to be sure it's right
if (objArgs.Count() < 2) Then
WScript.Echo("VC6 or 5 DSP Project File Conversion")
WScript.Echo("Opens specified .dsp and converts to VC7.1 Format.")
WScript.Echo("Will create project file with .vcproj extension")
WScript.Echo("usage: <full path\project.dsp> <full path\project.vcproj>")
WScript.Quit(1)
End If
WScript.Echo("Converting: "+ objArgs.Item(0))
'// If there is a file name of the .vcproj extension, do not convert
Set vcProject = vcProj.LoadProject(objArgs.Item(0))
If Not objFile.FileExists(vcProject.ProjectFile) Then
' // specify name and location of new project file
vcProject.ProjectFile = objArgs.Item(1)
' // call the project engine to save this off.
' // when no name is shown, it will create one with the .vcproj name
vcProject.Save()
WScript.Echo("New Project Name: "+vcProject.ProjectFile+"")
else
WScript.Echo("ERROR!: "+vcProject.ProjectFile+" already exists!")
End If
Set vcProj = CreateObject("VisualStudio.VCProjectEngine.8.0")
Set objFile = Createobject("Scripting.FileSystemObject")
Set objArgs = WScript.Arguments
'// check the arguments to be sure it's right
if (objArgs.Count() < 2) Then
WScript.Echo("VC6 or 5 DSP Project File Conversion")
WScript.Echo("Opens specified .dsp and converts to VC7.1 Format.")
WScript.Echo("Will create project file with .vcproj extension")
WScript.Echo("usage: <full path\project.dsp> <full path\project.vcproj>")
WScript.Quit(1)
End If
WScript.Echo("Converting: "+ objArgs.Item(0))
'// If there is a file name of the .vcproj extension, do not convert
Set vcProject = vcProj.LoadProject(objArgs.Item(0))
If Not objFile.FileExists(vcProject.ProjectFile) Then
' // specify name and location of new project file
vcProject.ProjectFile = objArgs.Item(1)
' // call the project engine to save this off.
' // when no name is shown, it will create one with the .vcproj name
vcProject.Save()
WScript.Echo("New Project Name: "+vcProject.ProjectFile+"")
else
WScript.Echo("ERROR!: "+vcProject.ProjectFile+" already exists!")
End If
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objArgs = WScript.Arguments
StartPos = InstrRev(objargs(0), "/", -1, 1)
strlength = Len(objargs(0))
If objArgs.Count > 1 Then
Path= Showpath(objargs(1))
Else
Path= Showpath(".")
End If
Wget objargs(0), Path & "\", Right(objargs(0),strlength-StartPos)
Sub Wget(URL, DestFolder, Imagefile)
Set xml = CreateObject("Microsoft.XMLHTTP")
xml.Open "GET", URL, False
xml.Send
set oStream = createobject("Adodb.Stream")
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
Const adSaveCreateNotExist = 1
oStream.type = adTypeBinary
oStream.open
oStream.write xml.responseBody
' Do not overwrite an existing file
oStream.savetofile DestFolder & ImageFile, adSaveCreateNotExist
' Use this form to overwrite a file if it already exists
' oStream.savetofile DestFolder & ImageFile, adSaveCreateOverWrite
oStream.close
set oStream = nothing
Set xml = Nothing
End Sub
Function Showpath(folderspec)
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec)
showpath = f.path
End Function
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论