in pekko-connectors-sample-rotate-logs-to-ftp/src/main/java/playground/filesystem/JimfsFactory.java [51:73]
public FileSystemView createFileSystemView(User user) throws FtpException {
synchronized (user) {
// create home if does not exist
if (createHome) {
String homeDirStr = user.getHomeDirectory();
Path homeDir = fileSystem.getPath(homeDirStr);
if (Files.isRegularFile(homeDir)) {
LOG.warn("Not a directory :: " + homeDirStr);
throw new FtpException("Not a directory :: " + homeDirStr);
}
if (!Files.exists(homeDir)) {
try {
Files.createDirectories(homeDir);
} catch (IOException t) {
final String msg = "Cannot create user home :: " + homeDirStr;
LOG.warn(msg);
throw new FtpException(msg, t);
}
}
}
return new JimfsView(fileSystem, user, caseInsensitive);
}
}