@@ -75,6 +75,20 @@ if libVer < DMVersion or math.floor(libVer/65536%256) > math.floor(DMVersion/655
7575
7676sleep = ffi. os == " Windows" and (( ms = 100 ) -> ffi. C . Sleep ms) or (( ms = 100 ) -> ffi. C . usleep ms* 1000 )
7777
78+ msgs = {
79+ notInitialized : " #{@__name} not initialized." ,
80+ addMissingArgs : " Required arguments #1 (url) or #2 (outfile) had the wrong type. Expected string, got '%s' and '%s'." ,
81+ getMissingArg : " Required argument (filename) was either absent or the wrong type. Expected string, got '%s'." ,
82+ checkMissingArgs : " Required arguments #1 (filename/string) and #2 (expected) or the wrong type. Expected string, got '%s' and '%s'." ,
83+ outNoFullPath : " Argument #2 (outfile) must contain a full path (relative paths not supported), got %s." ,
84+ outNoFile : " Argument #2 (outfile) must contain a full path with file name, got %s." ,
85+ failedToOpen : " Could not open file %s." ,
86+ hashMismatch : " Hash mismatch. Got %s, expected %s." ,
87+ horriblyWrong : " Something has gone horribly wrong???" ,
88+ cacheFailure : " Couldn't use cache. Message: %s" ,
89+ failedToAdd : " Could not add download for some reason."
90+ }
91+
7892sanitizeFile = ( filename, acceptDir ) ->
7993 -- expand leading ~.
8094 if homeDir = os.getenv " HOME"
@@ -176,20 +190,6 @@ class DownloadManager
176190 }
177191 : loadedLibraryPath
178192
179- msgs = {
180- notInitialized : " #{@__name} not initialized." ,
181- addMissingArgs : " Required arguments #1 (url) or #2 (outfile) had the wrong type. Expected string, got '%s' and '%s'." ,
182- getMissingArg : " Required argument (filename) was either absent or the wrong type. Expected string, got '%s'." ,
183- checkMissingArgs : " Required arguments #1 (filename/string) and #2 (expected) or the wrong type. Expected string, got '%s' and '%s'." ,
184- outNoFullPath : " Argument #2 (outfile) must contain a full path (relative paths not supported), got %s." ,
185- outNoFile : " Argument #2 (outfile) must contain a full path with file name, got %s." ,
186- failedToOpen : " Could not open file %s." ,
187- hashMismatch : " Hash mismatch. Got %s, expected %s." ,
188- horriblyWrong : " Something has gone horribly wrong???" ,
189- cacheFailure : " Couldn't use cache. Message: %s" ,
190- failedToAdd : " Could not add download for some reason."
191- }
192-
193193 freeManager = ( manager ) ->
194194 DM . CDlM_freeDM manager
195195
@@ -298,7 +298,7 @@ class DownloadManager
298298 getFileSHA1 : ( filename ) =>
299299 filenameType = type filename
300300 if filenameType != " string"
301- return nil , msgs. getMissingArg\ format stringType
301+ return nil , msgs. getMissingArg\ format filenameType
302302
303303 result = DM . CDlM_getFileSHA1 filename
304304 if result == nil
@@ -313,7 +313,7 @@ class DownloadManager
313313 if filenameType != " string" or expectedType != " string"
314314 return nil , msgs. checkMissingArgs\ format filenameType, expectedType
315315
316- result, msg = getFileSHA1 filename
316+ result, msg = @ getFileSHA1 filename
317317 if result == nil
318318 return result, msg
319319 elseif result == expected\ lower!
0 commit comments