Libraryless. Click here for Pure Java version (4344L/29K).
1 | static File loadDataSnippetToFile(S snippetID) ctex { |
2 | ifndef NoResourceLoader |
3 | IResourceLoader rl = vm_getResourceLoader(); |
4 | if (rl != null) |
5 | ret rl.loadLibrary(snippetID); |
6 | endifndef |
7 | |
8 | ret loadDataSnippetToFile_noResourceLoader(snippetID); |
9 | } |
10 | |
11 | static File loadDataSnippetToFile_noResourceLoader(S snippetID) ctex { |
12 | snippetID = fsI(snippetID); |
13 | |
14 | File f = DiskSnippetCache_file(parseSnippetID(snippetID)); |
15 | new L<URL> urlsTried; |
16 | new L<Throwable> errors; |
17 | try { |
18 | URL url = addAndReturn(urlsTried, new URL(dataSnippetLink(snippetID))); |
19 | print("Loading library: " + hideCredentials(url)); |
20 | try { |
21 | loadBinaryPageToFile(openConnection(url), f); |
22 | if (fileSize(f) == 0) fail(); |
23 | } catch e { |
24 | errors.add(e); |
25 | url = addAndReturn(urlsTried, new URL(tb_mainServer() + "/blobs/" + psI(snippetID))); |
26 | print(e); |
27 | print("Trying other server: " + hideCredentials(url)); |
28 | loadBinaryPageToFile(openConnection(url), f); |
29 | print("Got bytes: " + fileSize(f)); |
30 | } |
31 | // TODO: check if we hit the "LOADING" message |
32 | if (fileSize(f) == 0) fail(); |
33 | System.err.println("Bytes loaded: " + fileSize(f)); |
34 | } catch e { |
35 | //printStackTrace(e); |
36 | errors.add(e); |
37 | fail("Binary snippet " + snippetID + " not found or not public. URLs tried: " + allToString(urlsTried) + ", errors: " + allToString(errors)); |
38 | } |
39 | return f; |
40 | } |
Began life as a copy of #1000675
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1008031 |
Snippet name: | loadDataSnippetToFile - TODO: what's the difference to loadBinarySnippet? |
Eternal ID of this version: | #1008031/31 |
Text MD5: | 2e05f36d888f39877c910f4849ba1f61 |
Transpilation MD5: | c4ec7b62c160f2e0eeca83facedf82d7 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-10-14 16:01:48 |
Source code size: | 1418 bytes / 40 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 690 / 804 |
Version history: | 30 change(s) |
Referenced in: | [show references] |