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

15
LINES

< > BotCompany Repo | #1000827 // mkdirsForFile

JavaX fragment (include)

1  
public static File mkdirsForFile(File file) {
2  
  File dir = file.getParentFile();
3  
  if (dir != null) { // is null if file is in current dir
4  
    dir.mkdirs();
5  
    if (!dir.isDirectory())
6  
      if (dir.isFile()) fail("Please delete the file " + f2s(dir) + " - it is supposed to be a directory!");
7  
      else fail("Unknown IO exception during mkdirs of " + f2s(file));
8  
  }
9  
  ret file;
10  
}
11  
12  
public static S mkdirsForFile(S path) {
13  
  mkdirsForFile(new File(path));
14  
  ret path;
15  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1000827
Snippet name: mkdirsForFile
Eternal ID of this version: #1000827/7
Text MD5: a4f55f6e502e5c9550f4f1c87f261e66
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-15 19:29:23
Source code size: 484 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 691 / 3425
Version history: 6 change(s)
Referenced in: [show references]