Commit 7c06bed1 authored by maruel@chromium.org's avatar maruel@chromium.org

Fix a typo in get_files.js. Also fix style.

TBR=skylined
Review URL: http://codereview.chromium.org/102004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@14760 0039d316-1c4b-4281-b951-d872f2087c98
parent c1675e27
...@@ -6,7 +6,6 @@ function Download(url, path, verbose) { ...@@ -6,7 +6,6 @@ function Download(url, path, verbose) {
if (verbose) { if (verbose) {
WScript.StdOut.Write(" * GET " + url + "..."); WScript.StdOut.Write(" * GET " + url + "...");
} }
var response_body = null;
try { try {
xml_http = new ActiveXObject("MSXML2.ServerXMLHTTP"); xml_http = new ActiveXObject("MSXML2.ServerXMLHTTP");
} catch (e) { } catch (e) {
...@@ -21,8 +20,10 @@ function Download(url, path, verbose) { ...@@ -21,8 +20,10 @@ function Download(url, path, verbose) {
": invalid URL."); ": invalid URL.");
WScript.Quit(1); WScript.Quit(1);
} }
var response_body = null;
var size_description = "?"; var size_description = "?";
var file_size var file_size;
try { try {
xml_http.send(null); xml_http.send(null);
if (xml_http.status != 200) { if (xml_http.status != 200) {
...@@ -60,7 +61,7 @@ function Download(url, path, verbose) { ...@@ -60,7 +61,7 @@ function Download(url, path, verbose) {
adodb_stream.Type = 1; // 1= Binary adodb_stream.Type = 1; // 1= Binary
adodb_stream.Open(); // Open the stream adodb_stream.Open(); // Open the stream
adodb_stream.Write(response_body); // Write the data adodb_stream.Write(response_body); // Write the data
adodb_stream.SaveTfile(path, 2); // Save to our destination adodb_stream.SaveToFile(path, 2); // Save to our destination
adodb_stream.Close(); adodb_stream.Close();
} catch(e) { } catch(e) {
WScript.StdOut.WriteLine("[-] ADODB.Stream " + new Number( WScript.StdOut.WriteLine("[-] ADODB.Stream " + new Number(
...@@ -68,8 +69,8 @@ function Download(url, path, verbose) { ...@@ -68,8 +69,8 @@ function Download(url, path, verbose) {
WScript.Quit(1); WScript.Quit(1);
} }
if (typeof(file_size) != undefined) { if (typeof(file_size) != undefined) {
file_system_object = WScript.CreateObject("Scripting.FileSystemObject") var file_system_object = WScript.CreateObject("Scripting.FileSystemObject")
file = file_system_object.GetFile(path) var file = file_system_object.GetFile(path)
if (file.Size < file_size) { if (file.Size < file_size) {
WScript.StdOut.WriteLine("[-] File only partially downloaded."); WScript.StdOut.WriteLine("[-] File only partially downloaded.");
WScript.Quit(1); WScript.Quit(1);
...@@ -80,6 +81,7 @@ function Download(url, path, verbose) { ...@@ -80,6 +81,7 @@ function Download(url, path, verbose) {
} }
} }
// Utilities
Number.prototype.isInt = function NumberIsInt() { Number.prototype.isInt = function NumberIsInt() {
return this % 1 == 0; return this % 1 == 0;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment