Libraryless. Click here for Pure Java version (5478L/37K).
static IResourceLoader resourceLoaderFromDirWithInitializing(File dir) { ret new IResourceLoader { public S loadSnippet(S snippetID) ctex { long id = psI(snippetID); File f = newFile(dir, id + ".text"); S text = loadTextFile(f); if (text != null) ret text; saveTextFile(f, text = loadSnippet_noResourceLoader(id, false)); ret text; } public S getTranspiled(S snippetID) { long id = psI(snippetID); File f = newFile(dir, id + ".transpiled"); if (fileExists(f)) ret loadTextFile(f); S src = getServerTranspiled2_noResourceLoader(snippetID); saveTextFile(f, src); ret src; } public int getSnippetType(S snippetID) { long id = psI(snippetID); File f = newFile(dir, id + ".type"); if (fileExists(f)) ret parseInt(loadTextFileTrim(f)); int type = getSnippetType_noResourceLoader(id); saveTextFile(f, str(type)); ret type; } public S getSnippetTitle(S snippetID) { long id = psI(snippetID); File f = newFile(dir, id + ".title"); if (fileExists(f)) ret loadTextFileTrim(f); S title = getSnippetTitle_noResourceLoader(snippetID); saveTextFile(f, title); ret title; } public File loadLibrary(S snippetID) { long id = psI(snippetID); File f = newFile(dir, isImageServerSnippet(id) ? id + ".png" : id + ".bin"); if (fileExists(f)) ret f; copyFile(loadBinarySnippet_noResourceLoader(snippetID), f); ret f; } }; }
Began life as a copy of #1029946
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1029949 |
| Snippet name: | resourceLoaderFromDirWithInitializing [loads missing code from code.botcompany.de] |
| Eternal ID of this version: | #1029949/11 |
| Text MD5: | 0bb125c28582d9323fe49b603a8deded |
| Transpilation MD5: | 68003a74b6fbc1cab3aa118ce3e15c2f |
| Author: | stefan |
| Category: | javax / packaging |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-10-14 14:41:55 |
| Source code size: | 1619 bytes / 51 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 436 / 592 |
| Version history: | 10 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1029951 - resourceLoaderFromLiveCodeDirWithInitializing [loads missing code from code.botcompany.de] |