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).

sS loadSecretTextFileOrCreateWithRandomID(S name) {
  S id = trim(loadSecretTextFile(name));
  if (empty(id))
    saveSecretTextFile(name, id = aGlobalID());
  ret id;
}

sS loadSecretTextFileOrCreateWithRandomID(File f) {
  S id = trim(loadTextFile(f));
  if (empty(id))
    saveTextFile(f, id = aGlobalID());
  ret id;
}

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: 133 / 209
Version history: 2 change(s)
Referenced in: [show references]