1 | static java.io.File virtual_newFile(String path) { |
2 | return new java.io.File(virtual_rebase(path)); |
3 | } |
4 | |
5 | static java.io.FileInputStream virtual_newFileInputStream(String path) { |
6 | return new java.io.FileInputStream(virtual_rebase(path)); |
7 | } |
8 | |
9 | static java.io.FileInputStream virtual_newFileOutputStream(String path) { |
10 | return new java.io.FileOutputStream(virtual_rebase(path)); |
11 | } |
12 | |
13 | static String virtual_baseDir = ""; |
14 | |
15 | static String virtual_rebase(String path) { |
16 | if (new File(path).isAbsolute()) |
17 | return path; |
18 | else |
19 | return new File(new File(virtual_baseDir), path).getPath(); |
20 | } |
Began life as a copy of #2000345
Snippet is not live.
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #2000346 |
Snippet name: | Virtualized java.io file functions (fixed) |
Eternal ID of this version: | #2000346/1 |
Text MD5: | 789862473b0d7080014d9dc2a6b53996 |
Author: | stefan |
Category: | javax |
Type: | New Tinybrain snippet |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-05-11 17:52:40 |
Source code size: | 601 bytes / 20 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 760 / 170 |
Referenced in: | [show references] |