cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [02/16] updated wp7 + wp8 to 2.8.x branch
Date Mon, 03 Jun 2013 22:08:02 GMT
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/e69e35bb/lib/cordova-wp8/templates/standalone/www/index.html
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/www/index.html b/lib/cordova-wp8/templates/standalone/www/index.html
index 31f61f4..e8fb3e5 100644
--- a/lib/cordova-wp8/templates/standalone/www/index.html
+++ b/lib/cordova-wp8/templates/standalone/www/index.html
@@ -33,7 +33,7 @@
                 <p class="event received">Device is Ready</p>
             </div>
         </div>
-        <script type="text/javascript" src="cordova-2.7.0.js"></script>
+        <script type="text/javascript" src="cordova.js"></script>
         <script type="text/javascript" src="js/index.js"></script>
         <script type="text/javascript">
             app.initialize();

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/e69e35bb/lib/cordova-wp8/templates/vs/MyTemplateStandAlone.vstemplate
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/vs/MyTemplateStandAlone.vstemplate b/lib/cordova-wp8/templates/vs/MyTemplateStandAlone.vstemplate
index d7e4a70..7f438d8 100644
--- a/lib/cordova-wp8/templates/vs/MyTemplateStandAlone.vstemplate
+++ b/lib/cordova-wp8/templates/vs/MyTemplateStandAlone.vstemplate
@@ -1,13 +1,13 @@
 <VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005"
Type="Project">
   <TemplateData>
-    <Name>CordovaWP8_2_7_0</Name>
-    <Description>Cordova 2.7.0 for Windows Phone 8 using the Cordova source code directly.</Description>
+    <Name>CordovaWP8_2_8_0rc1</Name>
+    <Description>Cordova 2.8.0rc1 for Windows Phone 8 using the Cordova source code
directly.</Description>
     <ProjectType>CSharp</ProjectType>
     <ProjectSubType>
     </ProjectSubType>
     <SortOrder>1000</SortOrder>
     <CreateNewFolder>true</CreateNewFolder>
-    <DefaultName>CordovaWP8_2_7_0</DefaultName>
+    <DefaultName>CordovaWP8_2_8_0rc1</DefaultName>
     <ProvideDefaultName>true</ProvideDefaultName>
     <LocationField>Enabled</LocationField>
     <EnableLocationBrowseButton>true</EnableLocationBrowseButton>
@@ -96,7 +96,7 @@
       <ProjectItem ReplaceParameters="false" TargetFileName="SplashScreenImage.jpg">SplashScreenImage.jpg</ProjectItem>
       <ProjectItem ReplaceParameters="false" TargetFileName="VERSION">VERSION</ProjectItem>
       <Folder Name="www" TargetFolderName="www">
-        <ProjectItem ReplaceParameters="true" TargetFileName="cordova-2.7.0.js">cordova-2.7.0.js</ProjectItem>
+        <ProjectItem ReplaceParameters="true" TargetFileName="cordova.js">cordova.js</ProjectItem>
         <Folder Name="css" TargetFolderName="css">
           <ProjectItem ReplaceParameters="true" TargetFileName="index.css">index.css</ProjectItem>
         </Folder>
@@ -108,6 +108,37 @@
           <ProjectItem ReplaceParameters="true" TargetFileName="index.js">index.js</ProjectItem>
         </Folder>
       </Folder>
+      <Folder Name="cordova" TargetFolderName="cordova">
+        <ProjectItem ReplaceParameters="false" TargetFileName="build.bat">build.bat</ProjectItem>
+        <ProjectItem ReplaceParameters="false" TargetFileName="clean.bat">clean.bat</ProjectItem>
+        <ProjectItem ReplaceParameters="false" TargetFileName="log.bat">log.bat</ProjectItem>
+        <ProjectItem ReplaceParameters="false" TargetFileName="run.bat">run.bat</ProjectItem>
+        <ProjectItem ReplaceParameters="false" TargetFileName="version.bat">version.bat</ProjectItem>
+        <Folder Name="lib" TargetFolderName="lib">
+          <ProjectItem ReplaceParameters="false" TargetFileName="build.js">build.js</ProjectItem>
+          <ProjectItem ReplaceParameters="false" TargetFileName="clean.js">clean.js</ProjectItem>
+          <ProjectItem ReplaceParameters="false" TargetFileName="deploy.js">deploy.js</ProjectItem>
+          <ProjectItem ReplaceParameters="false" TargetFileName="install-device.bat">install-device.bat</ProjectItem>
+          <ProjectItem ReplaceParameters="false" TargetFileName="install-emulator.bat">install-emulator.bat</ProjectItem>
+          <ProjectItem ReplaceParameters="false" TargetFileName="list-devices.bat">list-devices.bat</ProjectItem>
+          <ProjectItem ReplaceParameters="false" TargetFileName="list-emulator-images.bat">list-emulator-images.bat</ProjectItem>
+          <ProjectItem ReplaceParameters="false" TargetFileName="list-started-emulators.bat">list-started-emulators.bat</ProjectItem>
+          <ProjectItem ReplaceParameters="false" TargetFileName="log.js">log.js</ProjectItem>
+          <ProjectItem ReplaceParameters="false" TargetFileName="start-emulator.bat">start-emulator.bat</ProjectItem>
+          <ProjectItem ReplaceParameters="false" TargetFileName="target-list.js">target-list.js</ProjectItem>
+          <Folder Name="CordovaDeploy" TargetFolderName="CordovaDeploy">
+            <ProjectItem ReplaceParameters="false" TargetFileName="CordovaDeploy.sln">CordovaDeploy.sln</ProjectItem>
+            <Folder Name="CordovaDeploy" TargetFolderName="CordovaDeploy">
+              <ProjectItem ReplaceParameters="false" TargetFileName="app.config">app.config</ProjectItem>
+              <ProjectItem ReplaceParameters="false" TargetFileName="CordovaDeploy.csproj">CordovaDeploy.csproj</ProjectItem>
+              <ProjectItem ReplaceParameters="false" TargetFileName="Program.cs">Program.cs</ProjectItem>
+              <Folder Name="Properties" TargetFolderName="Properties">
+                <ProjectItem ReplaceParameters="false" TargetFileName="AssemblyInfo.cs">AssemblyInfo.cs</ProjectItem>
+              </Folder>
+            </Folder>
+          </Folder>
+        </Folder>
+      </Folder>
     </Project>
   </TemplateContent>
 </VSTemplate>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/e69e35bb/lib/cordova-wp8/templates/vs/description.txt
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/vs/description.txt b/lib/cordova-wp8/templates/vs/description.txt
index b8c91ec..7007873 100644
--- a/lib/cordova-wp8/templates/vs/description.txt
+++ b/lib/cordova-wp8/templates/vs/description.txt
@@ -1,8 +1,8 @@
 CordovaWP8_2_6_0_Full
-Apache Cordova 2.7.0 Windows Phone 8 App using a pre-built dll.
+Apache Cordova 2.8.0rc1 Windows Phone 8 App using a pre-built dll.
 
 CordovaWP8_2_6_0_StandAlone
-Apache Cordova 2.7.0 Windows Phone 8 App including all framework source code.
+Apache Cordova 2.8.0rc1 Windows Phone 8 App including all framework source code.
 
 
 

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/e69e35bb/lib/cordova-wp8/tooling/scripts/buildjs.js
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tooling/scripts/buildjs.js b/lib/cordova-wp8/tooling/scripts/buildjs.js
index 78e213c..9cd74fc 100644
--- a/lib/cordova-wp8/tooling/scripts/buildjs.js
+++ b/lib/cordova-wp8/tooling/scripts/buildjs.js
@@ -28,9 +28,6 @@ var args = WScript.Arguments,
     TEMPLATES_PATH = '\\templates',
     //Sub folder for standalone project
     STANDALONE_PATH = TEMPLATES_PATH + '\\standalone',
-    //Sub folder for full project
-    FULL_PATH = TEMPLATES_PATH + '\\full',
-    CUSTOM_PATH = TEMPLATES_PATH + '\\custom',
     //Sub folder containing framework
     FRAMEWORK_PATH = '\\framework',
     //Subfolder containing example project
@@ -41,9 +38,6 @@ var args = WScript.Arguments,
     VERSION = read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,''),
     BUILD_DESTINATION;
 
-function Log(msg) {
-    WScript.StdOut.WriteLine(msg);
-}
 
 // help function
 function Usage()
@@ -61,6 +55,16 @@ function Usage()
     Log("");
 }
 
+// logs messaged to stdout and stderr
+function Log(msg, error) {
+    if (error) {
+        WScript.StdErr.WriteLine(msg);
+    }
+    else {
+        WScript.StdOut.WriteLine(msg);
+    }
+}
+
 // returns the contents of a file
 function read(filename) {
     //Log('Reading in ' + filename);
@@ -104,7 +108,7 @@ function exec_verbose(command) {
     if(!oShell.StdErr.AtEndOfStream)
     {
         var err_line = oShell.StdErr.ReadAll();
-        WScript.StdErr.WriteLine(err_line);
+        Log(err_line, true);
         WScript.Quit(1);
     }
 }
@@ -137,10 +141,8 @@ function build_js(path)
 
     //copy the javascript wherever it needs to go.
     wscript_shell.CurrentDirectory = path + '\\temp\\cordova-js\\pkg';
-    exec('%comspec% /c copy /Y cordova.windowsphone.js ' + path + STANDALONE_PATH + '\\www\\cordova-'
+ VERSION + '.js');
-    exec('%comspec% /c copy /Y cordova.windowsphone.js ' + path + FULL_PATH + '\\www\\cordova-'
+ VERSION + '.js');
-    exec('%comspec% /c copy /Y cordova.windowsphone.js ' + path + CUSTOM_PATH + '\\www\\cordova-'
+ VERSION + '.js');
-    exec('%comspec% /c copy /Y cordova.windowsphone.js ' + path + EXAMPLE_PATH + '\\www\\cordova-'
+ VERSION + '.js');
+    exec('%comspec% /c copy /Y cordova.windowsphone.js ' + path + STANDALONE_PATH + '\\www\\cordova.js');
+    exec('%comspec% /c copy /Y cordova.windowsphone.js ' + path + EXAMPLE_PATH + '\\www\\cordova.js');
 
     //TODO: Delete old cordova.js (done in reversion.js)
 
@@ -159,10 +161,10 @@ function set_path(some_arg)
         }
         else
         {
-            Log("ERROR: The given path is not a cordova-wp8 repo, or");
-            Log(" does not exist. If your trying to reversion a");
-            Log(" cordova repo other then this one, please provide");
-            Log(" it's path in the form: -p:C:\\Path\\to\\repo");
+            Log("ERROR: The given path is not a cordova-wp8 repo, or", true);
+            Log(" does not exist. If your trying to reversion a", true);
+            Log(" cordova repo other then this one, please provide", true);
+            Log(" it's path in the form: -p:C:\\Path\\to\\repo", true);
             WScript.Quit(1);
         }
         
@@ -198,8 +200,8 @@ if(args.Count() > 0)
     else if(set_path(arg(0))) {} //do nothing
     else
     {
-        Log("The provided version number is invalid, please provide");
-        Log(" a version number in the format Major.Minor.Fix[rc#]");
+        Log("The provided version number is invalid, please provide", true);
+        Log(" a version number in the format Major.Minor.Fix[rc#]", true);
         Usage();
         WScript.Quit(1);
     }

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/e69e35bb/lib/cordova-wp8/tooling/scripts/dist.js
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tooling/scripts/dist.js b/lib/cordova-wp8/tooling/scripts/dist.js
index 9dd93e6..630133d 100644
--- a/lib/cordova-wp8/tooling/scripts/dist.js
+++ b/lib/cordova-wp8/tooling/scripts/dist.js
@@ -36,7 +36,7 @@ var fso = WScript.CreateObject('Scripting.FileSystemObject'),
     wscript_shell = WScript.CreateObject("WScript.Shell");
 
 //Replace root directory or create new directory?
-var REPLACE = false;
+var replace = false;
 
 //Set up directory structure of current release
     //arguments passed in
@@ -58,9 +58,6 @@ var current_script = "dist";
 /****************  FUNCTIONS  ********************/
 /*************************************************/
 
-function Log(msg) {
-    WScript.StdOut.WriteLine(msg);
-}
 
 // help function
 function Usage()
@@ -68,12 +65,22 @@ function Usage()
   Log("");
   Log("This is a command line tool for building new releases. It will package a new release");
   Log(" of a cordova-wp8 project, reversioning it to match the VERSION file in the root directory.");
-  Log("Usage: dist [ <NEW_PATH_FOR_BUILD> | -f ] ");
-  Log("                       -f : force tool to reversion the current repositoy.");
-  Log("     <NEW_PATH_FOR_BUILD> : path to create the new reversioned repositoy in.");
+  Log("Usage: dist [ <PATH_TO_NEW_REPO> | -f ] ");
+  Log("                       -f : reversion the repositoy this script is in.");
+  Log("       <PATH_TO_NEW_REPO> : path to create the new reversioned repositoy in.");
   Log("");
 }
 
+// logs messaged to stdout and stderr
+function Log(msg, error) {
+    if (error) {
+        WScript.StdErr.WriteLine(msg);
+    }
+    else {
+        WScript.StdOut.WriteLine(msg);
+    }
+}
+
 
 // returns the contents of a file
 function read(filename) {
@@ -110,8 +117,8 @@ function exec(command) {
     if(!oShell.StdErr.AtEndOfStream)
     {
         var err_line = oShell.StdErr.ReadAll();
-        WScript.StdErr.WriteLine(err_line);
-        WScript.StdErr.WriteLine("ERROR: Could not complete distribution, failed while running:
" + current_script);
+        Log(err_line, true);
+        Log("ERROR: Could not complete distribution, failed while running: " + current_script,
true);
         WScript.Quit(1);
     }
 }
@@ -128,29 +135,43 @@ function space()
 /**************  MAIN SCRIPT  ********************/
 /*************************************************/
 
-if(REPLACE)
-{
-    BUILD_DESTINATION = ROOT;
-}
-else if(args.Count() > 0)
-{
-    if(args(0) == '-f') {
-        REPLACE = true;
-        BUILD_DESTINATION = ROOT;
-    } else {
-       BUILD_DESTINATION = args(0);
-      //Support help flags
-      if(BUILD_DESTINATION.indexOf("--help") > -1 ||
-           BUILD_DESTINATION.indexOf("/?") > -1 )
-      {
-          Usage();
-          WScript.Quit(1);
-      }
-    }
+if (args.Count() > 0) {
+    if (args.Count() == 1) {
+        // support help flags
+        if (args(0).indexOf("--help") > -1 ||
+              args(0).indexOf("/?") > -1 ) {
+            Usage();
+            WScript.Quit(1);
+        }
+        else if (args(0) == '-f') {
+          BUILD_DESTINATION = ROOT;
+          replace = true;
+        }
+        else {
+          BUILD_DESTINATION = args(0);
+        }
 
+    }
+    else if (args.Count() == 2) {
+        if (args(0) == '-f') {
+            replace = true;
+            BUILD_DESTINATION = args(1);
+        } else {
+           BUILD_DESTINATION = args(0);
+           if (args(1) == '-f') {
+              replace = true;
+           }
+           else {
+              Log('WARNING : "' + args(1) + '" is not regognized, attempting to continue
distribution.');
+           }
+        }
+    }
+    else {
+        Log("Error : too many arguments provided.", true);
+        WScript.Quit(1);
+    }
 }
-else
-{
+else {
     Usage();
     WScript.Quit(1);
 }
@@ -161,7 +182,7 @@ else
 /*************************************************/
 /** - Copy source code to new directory         **/
 /*************************************************/
-if (!REPLACE) {
+if (!replace) {
   current_script = "new.js";
   exec('cscript ' + ROOT + SCRIPTS + '\\new.js ' + BUILD_DESTINATION + ' //nologo');
   space();
@@ -185,9 +206,10 @@ space();
 /** - build cordova.js                          **/
 /** - windows.cordova.js -> templates + example **/
 /*************************************************/
-current_script = "buildjs.js";
-exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\buildjs.js //nologo');
-space();
+// New Workflow does not require building the new js, it should already be in place.
+// current_script = "buildjs.js";
+// exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\buildjs.js //nologo');
+// space();
 
 /*************************************************/
 /******************  Step 5  *********************/

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/e69e35bb/lib/cordova-wp8/tooling/scripts/package.js
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tooling/scripts/package.js b/lib/cordova-wp8/tooling/scripts/package.js
index 57a7340..71b61b5 100644
--- a/lib/cordova-wp8/tooling/scripts/package.js
+++ b/lib/cordova-wp8/tooling/scripts/package.js
@@ -43,7 +43,6 @@ var ADD_TO_VS = false;
 // build the dll?
 var BUILD_DLL = false;
 
-function Log(msg) { WScript.StdOut.WriteLine(msg); }
 
 // help function
 function Usage()
@@ -57,6 +56,16 @@ function Usage()
     Log("");
 }
 
+// logs messaged to stdout and stderr
+function Log(msg, error) {
+    if (error) {
+        WScript.StdErr.WriteLine(msg);
+    }
+    else {
+        WScript.StdOut.WriteLine(msg);
+    }
+}
+
 // returns the contents of a file
 function read(filename) {
     //Log('Reading in ' + filename);
@@ -100,7 +109,7 @@ function exec_verbose(command) {
     if(!oShell.StdErr.AtEndOfStream)
     {
         var err_line = oShell.StdErr.ReadAll();
-        WScript.StdErr.WriteLine(err_line);
+        Log(err_lin, true);
         WScript.Quit(1);
     }
 }
@@ -121,7 +130,7 @@ function package_templates()
     exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\pg_templatePreview.jpg
' + BUILD_DESTINATION + STANDALONE_PATH + '\\__PreviewImage.jpg');
     exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + '\\VERSION ' + BUILD_DESTINATION +
STANDALONE_PATH);
 
-    exec_verbose('cscript ' + BUILD_DESTINATION + '\\tooling\\scripts\\win-zip.js ' + template_path
+ ' ' + BUILD_DESTINATION + STANDALONE_PATH + '\\');
+    zip_project(template_path, BUILD_DESTINATION + STANDALONE_PATH);
 
 
     if(ADD_TO_VS)
@@ -139,6 +148,41 @@ function package_templates()
   }
 }
 
+function zip_project(zip_path, project_path) 
+{    
+    // create empty ZIP file and open for adding
+    var file = fso.CreateTextFile(zip_path, true);
+
+    // create twenty-two byte "fingerprint" for .zip
+    file.write("PK");
+    file.write(String.fromCharCode(5));
+    file.write(String.fromCharCode(6));
+    file.write('\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0');
+    file.Close();
+
+    // open .zip foder and copy contents of project_path to zip_path
+    var zipFolder = shell.NameSpace(zip_path);
+    var sourceItems = shell.NameSpace(project_path).items();
+    if (zipFolder !== null) {
+        zipFolder.CopyHere(sourceItems, 4|20|16);
+        var maxTime = 5000;
+        while(zipFolder.items().Count < sourceItems.Count)
+        {
+            maxTime -= 100;
+            if(maxTime > 0 ) {    
+                WScript.Sleep(100);
+            }
+            else {
+                Log('Failed to create .zip file.', true);
+                break;
+            }
+        }
+    }
+    else {
+        Log('Failed to create .zip file.', true);
+    }
+}
+
 // builds the new cordova dll and copys it to the full template (only done because of the
version referance in Device.cs)
 function build_dll()
 {

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/e69e35bb/lib/cordova-wp8/tooling/scripts/reversion.js
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tooling/scripts/reversion.js b/lib/cordova-wp8/tooling/scripts/reversion.js
index a726817..702733b 100644
--- a/lib/cordova-wp8/tooling/scripts/reversion.js
+++ b/lib/cordova-wp8/tooling/scripts/reversion.js
@@ -141,18 +141,9 @@ function updateVersionNumbers() {
     // update standalone project
     exec('%comspec% /c copy /Y /V ' + BUILD_DESTINATION + "\\VERSION " + BUILD_DESTINATION
+ STANDALONE_PATH + "\\VERSION");
     var cordova_regex = /cordova-(\d+)[.](\d+)[.](\d+)(rc\d)?/g; //Matches *first* cordova-x.x.x[rcx]
(just ad g at end to make global)
-    replaceInFile(BUILD_DESTINATION + STANDALONE_PATH + '\\CordovaAppProj.csproj', cordova_regex,
 "cordova-" + VERSION);
-    replaceInFile(BUILD_DESTINATION + STANDALONE_PATH + '\\www\\index.html', cordova_regex,
 "cordova-" + VERSION);
     version_regex = /return\s*\"(\d+)[.](\d+)[.](\d+)(rc\d)?/; //Matches return "x.x.x[rcx]
-
-    WScript.StdOut.WriteLine("path = " + BUILD_DESTINATION + CORDOVA_LIB + '\\Plugins\\Device.cs');
     replaceInFile(BUILD_DESTINATION + CORDOVA_LIB + '\\..\\Plugins\\Device.cs', version_regex,
 "return \"" + VERSION);
 
-    // update example proj
-    replaceInFile(BUILD_DESTINATION + EXAMPLE_PATH + '\\CordovaExample.csproj', cordova_regex,
 "cordova-" + VERSION);
-    version_regex = /VERSION\s*\=\s*\'(\d+)[.](\d+)[.](\d+)(rc\d)?/;  //Matches VERSION =
x.x.x[rcx]
-    replaceInFile(BUILD_DESTINATION + EXAMPLE_PATH + '\\www\\cordova-current.js', version_regex,
 "VERSION = \'" + VERSION);
-
     // update template discription
     version_regex = /Cordova\s*(\d+)[.](\d+)[.](\d+)(rc\d)?\s*Windows/g; //Matches version:
x.x.x[rcx]
     replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\description.txt', version_regex,
 "Cordova " + VERSION + " Windows");
@@ -163,7 +154,6 @@ function updateVersionNumbers() {
 
     replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateStandAlone.vstemplate',
name_regex,  'CordovaWP8_' + VERSION.replace(/\./g, '_'));
     replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateStandAlone.vstemplate',
discript_regex,  "Cordova " + VERSION);
-    replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateStandAlone.vstemplate',
cordova_regex,  "cordova-" + VERSION);
 }
 
 // delete all cordova.js and generated files (templates) from old version numbers

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/e69e35bb/lib/cordova-wp8/tooling/scripts/win-zip.js
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/tooling/scripts/win-zip.js b/lib/cordova-wp8/tooling/scripts/win-zip.js
deleted file mode 100644
index 7a79f43..0000000
--- a/lib/cordova-wp8/tooling/scripts/win-zip.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Script for zipping the contents of a directory.
- */
-
-// get commman line arguments
-var objArgs = WScript.Arguments;
-var zipPath = objArgs(0);
-var sourcePath = objArgs(1);
-
-
-// create empty ZIP file and open for adding
-var fso = new ActiveXObject("Scripting.FileSystemObject");
-var file = fso.CreateTextFile(zipPath, true);
-
-// create twenty-two byte "fingerprint" for .zip
-file.write("PK");
-file.write(String.fromCharCode(5));
-file.write(String.fromCharCode(6));
-file.write('\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0');
-file.Close();
-
-// open .zip foder and copy contents of sourcePath
-var objShell = new ActiveXObject("shell.application");
-var zipFolder = objShell.NameSpace(zipPath);
-var sourceItems = objShell.NameSpace(sourcePath).items();
-if (zipFolder !== null) {
-    zipFolder.CopyHere(sourceItems, 4|20|16);
-    var maxTime = 5000;
-    while(zipFolder.items().Count < sourceItems.Count)
-    {
-        maxTime -= 100;
-        if(maxTime > 0 ) {    
-            WScript.Sleep(100);
-        }
-        else {
-            WScript.StdErr.WriteLine('Failed to create .zip file.');
-            break;
-        }
-    }
-}
-else {
-	WScript.StdErr.WriteLine('Failed to create .zip file.');
-}
\ No newline at end of file


Mime
View raw message