1 | static File makeFileNameUnique_space(File f) { |
2 | S ext = fileExtension(f); |
3 | File orig = f; |
4 | int n = 1; |
5 | ext = addPrefixIfNempty(".", dropPrefix(".", ext)); |
6 | S name = dropSuffixIC(ext, orig.getName()); |
7 | f = new File(dirOfFile(orig), name + ext); |
8 | while (f.exists()) |
9 | f = new File(dirOfFile(orig), name + " " + (++n) + ext); |
10 | ret f; |
11 | } |
Began life as a copy of #1016338
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1018665 |
Snippet name: | makeFileNameUnique_space (by adding " 2", " 3", ...) |
Eternal ID of this version: | #1018665/1 |
Text MD5: | 9a0b6b0c2ed77ff8e0343ad2be944476 |
Author: | stefan |
Category: | javax / io |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-10-08 12:38:12 |
Source code size: | 352 bytes / 11 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 346 / 360 |
Referenced in: | [show references] |