// possible problem: case of keys (Windows only) static class DiskTextMap { File dir; *(S dirName) { dir = getProgramFile(dirName); dir.mkdirs(); } void clear() { deleteAllFilesWithSuffix(dir, ".text"); } S get(S key) { ret loadTextFile(getFile(key)); } File getFile(S key) { ret new File(dir, urlencode(key) + ".text"); } void remove(S key) { getFile(key).delete(); } void put(S key, S value) { saveTextFile(getFile(key), value); } int size() { ret l(listFilesWithSuffix(dir, ".text")); } Set<S> keySet() { new TreeSet<S> set; for (File f : listFilesWithSuffix(dir, ".text")) set.add(dropSuffix(".text", f.getName())); ret set; } }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1002087 |
Snippet name: | DiskTextMap |
Eternal ID of this version: | #1002087/1 |
Text MD5: | a88c50ee2d93fe01dcc4b338437a3eea |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-12-17 20:41:54 |
Source code size: | 779 bytes / 40 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 655 / 1589 |
Referenced in: | #1003872 - Integrating #759 in One Program #1003874 - Backup of #759 Before Integration #1004091 - 759 with new loadClasses (spike) #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) #3000382 - Answer for ferdie (>> t = 1, f = 0) |