mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-12-29 05:13:20 -08:00
DataStore now works
This commit is contained in:
parent
a9307693a6
commit
ad6ec22857
2 changed files with 23 additions and 7 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue