use of org.pentaho.di.plugins.fileopensave.providers.local.model.LocalFile in project pentaho-kettle by pentaho.
the class LocalFileProvider method getTree.
/**
* @return
*/
@Override
public Tree getTree() {
LocalTree localTree = new LocalTree(NAME);
List<LocalFile> rootFiles = new ArrayList<>();
ArrayList<Path> paths = new ArrayList<>();
if (Const.isRunningOnWebspoonMode()) {
Path kettleUserDataDirectoryPath = Paths.get(Const.getUserDataDirectory());
paths.add(kettleUserDataDirectoryPath);
} else {
FileSystems.getDefault().getRootDirectories().forEach(paths::add);
}
paths.forEach(path -> {
LocalDirectory localDirectory = new LocalDirectory();
localDirectory.setPath(path.toString());
localDirectory.setName(path.toString());
localDirectory.setRoot(NAME);
localDirectory.setHasChildren(true);
rootFiles.add(localDirectory);
});
localTree.setFiles(rootFiles);
return localTree;
}
use of org.pentaho.di.plugins.fileopensave.providers.local.model.LocalFile in project pentaho-kettle by pentaho.
the class LocalFileProvider method delete.
/**
* @param files
* @return
*/
public List<LocalFile> delete(List<LocalFile> files) {
List<LocalFile> deletedFiles = new ArrayList<>();
for (LocalFile file : files) {
try {
Files.delete(Paths.get(file.getPath()));
deletedFiles.add(file);
} catch (IOException ignored) {
// Don't add file to deleted array
}
}
return deletedFiles;
}
Aggregations