// find the parent node using the relative path to navigate there
FolderIndex parentNode = (FolderIndex) userProfile.getFileByPath(file.getParentFile(), root);
// validate the write protection
if (!parentNode.canWrite()) {
throw new ProcessExecutionException("This directory is write protected (and we don't have the keys).");
}
// create a file tree node in the user profile
parentKey = parentNode.getFilePublicKey();
// use the file keys generated above is stored
if (file.isDirectory()) {
FolderIndex folderIndex = new FolderIndex(parentNode, metaKeys, file.getName());
context.provideIndex(folderIndex);
} else {
FileIndex fileIndex = new FileIndex(parentNode, metaKeys, file.getName(), md5);
context.provideIndex(fileIndex);
}
// put the updated user profile
profileManager.readyToPut(userProfile, getID());
modified = true;
} catch (PutFailedException | GetFailedException e) {
throw new ProcessExecutionException(e);
}
}