Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #1002955 // LoadEnv (include)

JavaX fragment (include)

1  
// Defaults to standard environment (current program directory)
2  
// Subclass for any different environments!
3  
static class LoadEnv {
4  
  S loadStructure(S varName) {
5  
    ret loadTextFile(getProgramFile(varName + ".structure"));
6  
  }
7  
8  
  void saveStructure(S varName, S structure) {
9  
    saveTextFile(getProgramFile(varName + ".structure"), structure);
10  
  }
11  
12  
  void load(O o, S varName) {
13  
    S s = loadStructure(varName);
14  
    if (s != null)
15  
      setOpt(o, varName, unstructure(s));
16  
  }
17  
18  
  void save(O o, S varName) {
19  
    saveStructure(varName, structure(getOpt(o, varName)));
20  
  }
21  
}

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: #1002955
Snippet name: LoadEnv (include)
Eternal ID of this version: #1002955/1
Text MD5: e565a9cd49ede55683305065fa916162
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-04-10 22:11:31
Source code size: 594 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 728 / 1661
Referenced in: [show references]