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

15
LINES

< > BotCompany Repo | #1000827 - mkdirsForFile

JavaX fragment (include)

public static File mkdirsForFile(File file) {
  File dir = file.getParentFile();
  if (dir != null) { // is null if file is in current dir
    dir.mkdirs();
    if (!dir.isDirectory())
      if (dir.isFile()) fail("Please delete the file " + f2s(dir) + " - it is supposed to be a directory!");
      else fail("Unknown IO exception during mkdirs of " + f2s(file));
  }
  ret file;
}

public static S mkdirsForFile(S path) {
  mkdirsForFile(new File(path));
  ret path;
}

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

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