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

13
LINES

< > BotCompany Repo | #1028302 // loadSecretTextFileOrCreateWithRandomID

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2999L/19K).

1  
sS loadSecretTextFileOrCreateWithRandomID(S name) {
2  
  S id = trim(loadSecretTextFile(name));
3  
  if (empty(id))
4  
    saveSecretTextFile(name, id = aGlobalID());
5  
  ret id;
6  
}
7  
8  
sS loadSecretTextFileOrCreateWithRandomID(File f) {
9  
  S id = trim(loadTextFile(f));
10  
  if (empty(id))
11  
    saveTextFile(f, id = aGlobalID());
12  
  ret id;
13  
}

Author comment

Began life as a copy of #1001900

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028302
Snippet name: loadSecretTextFileOrCreateWithRandomID
Eternal ID of this version: #1028302/3
Text MD5: 77b96a82ee15248b488edd716c19925a
Transpilation MD5: 75a9a4a5390098d23ec51e346538ece7
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-09-27 14:55:35
Source code size: 334 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 207 / 308
Version history: 2 change(s)
Referenced in: [show references]