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

22
LINES

< > BotCompany Repo | #1006360 // CFile - concept representing a file on disk

JavaX fragment (include)

sclass CFile extends Concept {
  S fileProgID;
  S fileName; // optional, relative (program ID + "/" + file name)

  *() {}
  *(S *fileProgID, S *fileName) {}

  File file() {
    ret getProgramFile(fileProgID, fileName);
  }
  
  bool fileExists() {
    ret file().exists();
  }
  
  void makeDefaultName(S extension) {
    if (fileName != null || loading()) ret;
    if (id == 0) fail("No ID");
    fileProgID = dbProgramID();
    fileName = shortDynClassName(this) + id + addPrefix(".", extension);
  }
}

Author comment

Began life as a copy of #1005730

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: #1006360
Snippet name: CFile - concept representing a file on disk
Eternal ID of this version: #1006360/1
Text MD5: d041f2387cf4585bc613675e6bbd8084
Author: stefan
Category: javax / concepts
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-29 17:46:23
Source code size: 530 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 501 / 1002
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)