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)

1  
sclass CFile extends Concept {
2  
  S fileProgID;
3  
  S fileName; // optional, relative (program ID + "/" + file name)
4  
5  
  *() {}
6  
  *(S *fileProgID, S *fileName) {}
7  
8  
  File file() {
9  
    ret getProgramFile(fileProgID, fileName);
10  
  }
11  
  
12  
  bool fileExists() {
13  
    ret file().exists();
14  
  }
15  
  
16  
  void makeDefaultName(S extension) {
17  
    if (fileName != null || loading()) ret;
18  
    if (id == 0) fail("No ID");
19  
    fileProgID = dbProgramID();
20  
    fileName = shortDynClassName(this) + id + addPrefix(".", extension);
21  
  }
22  
}

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: 520 / 1019
Referenced in: [show references]