1 | static void moveFileVerboseIfExists(File a, File b) { |
2 | if (a == null || b == null) ret; |
3 | if (!fileExists(a)) ret with print(a + " not found, skipping move"); |
4 | if (!renameFile(a, b)) |
5 | fail("File move failed: " + a + " to " + b); |
6 | print("Moved: " + a + " to " + b); |
7 | } |
Began life as a copy of #1015320
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1020322 |
Snippet name: | moveFileVerboseIfExists - smarter version of File.renameTo(); asserts success. second argument is a target FILE NAME, not the DIR to put it in |
Eternal ID of this version: | #1020322/1 |
Text MD5: | a1cb7865cf91c7c4f33183592ece93cd |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-12-14 13:11:28 |
Source code size: | 278 bytes / 7 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 273 / 305 |
Referenced in: | [show references] |