openvidu-server: CustomFileManager#createAndWriteFileWithFolders

pull/370/head
pabloFuente 2019-12-17 16:39:37 +01:00
parent 13232496c0
commit 48097f5f9a
1 changed files with 9 additions and 0 deletions

View File

@ -42,6 +42,15 @@ public class CustomFileManager {
} }
} }
public boolean createAndWriteFileWithFolders(String filePath, String text) {
File f = new File(filePath);
if (!f.exists()) {
// This doesn't fail if no permissions
f.getParentFile().mkdirs();
}
return this.createAndWriteFile(filePath, text);
}
public boolean overwriteFile(String filePath, String text) { public boolean overwriteFile(String filePath, String text) {
try { try {
this.writeAndCloseOnOutputStreamWriter(new FileOutputStream(filePath, false), text); this.writeAndCloseOnOutputStreamWriter(new FileOutputStream(filePath, false), text);