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   

Travelled to 13 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, sawdedvomwva, tslmcundralx, tvejysmllsmz

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: 472 / 3089
Version history: 6 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1000827 & http://1000827.tinybrain.de