diff options
Diffstat (limited to 'java/src/com/zerotier/one/JavaFileProvider.java')
-rw-r--r-- | java/src/com/zerotier/one/JavaFileProvider.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/java/src/com/zerotier/one/JavaFileProvider.java b/java/src/com/zerotier/one/JavaFileProvider.java index 73c98a9e..41889e2f 100644 --- a/java/src/com/zerotier/one/JavaFileProvider.java +++ b/java/src/com/zerotier/one/JavaFileProvider.java @@ -16,20 +16,28 @@ public class JavaFileProvider implements DataStoreFileProvider { @Override public FileInputStream getInputFileStream(String name) throws FileNotFoundException { - File f = new File(_path + File.pathSeparator + name); + File f = new File(_path + File.separator + name); return new FileInputStream(f); } @Override public FileOutputStream getOutputFileStream(String name) throws FileNotFoundException { - File f = new File(_path + File.pathSeparator + name); + File f = new File(_path + File.separator + name); + if(!f.exists()) + { + try { + f.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } return new FileOutputStream(f); } @Override public void deleteFile(String name) throws IOException { - File f = new File(_path + File.pathSeparator + name); + File f = new File(_path + File.separator + name); boolean success = f.delete(); if(!success) { throw new IOException("Unable to delete file: " + _path + File.pathSeparator + name); |