mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: recording path initialization extended
parent
a3993ac3cf
commit
334a1d6b70
|
@ -526,11 +526,21 @@ public class RecordingManager {
|
||||||
|
|
||||||
private void initRecordingPath() throws OpenViduException {
|
private void initRecordingPath() throws OpenViduException {
|
||||||
log.info("Initializing recording path");
|
log.info("Initializing recording path");
|
||||||
try {
|
|
||||||
final String recPath = this.openviduConfig.getOpenViduRecordingPath();
|
final String recPath = this.openviduConfig.getOpenViduRecordingPath();
|
||||||
final String testFolderPath = recPath + "/TEST_RECORDING_PATH_" + System.currentTimeMillis();
|
final String testFolderPath = recPath + "/TEST_RECORDING_PATH_" + System.currentTimeMillis();
|
||||||
final String testFilePath = testFolderPath + "/TEST_RECORDING_PATH.webm";
|
final String testFilePath = testFolderPath + "/TEST_RECORDING_PATH.webm";
|
||||||
Path path = Files.createDirectories(Paths.get(recPath));
|
|
||||||
|
Path path = null;
|
||||||
|
try {
|
||||||
|
path = Files.createDirectories(Paths.get(recPath));
|
||||||
|
} catch (IOException e) {
|
||||||
|
String errorMessage = "The recording path \"" + recPath
|
||||||
|
+ "\" is not valid. Reason: OpenVidu Server cannot find path \"" + recPath
|
||||||
|
+ "\" and doesn't have permissions to create it";
|
||||||
|
log.error(errorMessage);
|
||||||
|
throw new OpenViduException(Code.RECORDING_PATH_NOT_VALID, errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
// Check OpenVidu Server write permissions in recording path
|
// Check OpenVidu Server write permissions in recording path
|
||||||
if (!Files.isWritable(path)) {
|
if (!Files.isWritable(path)) {
|
||||||
|
@ -587,19 +597,12 @@ public class RecordingManager {
|
||||||
+ "Try running Kurento Media Server as user \"" + System.getProperty("user.name")
|
+ "Try running Kurento Media Server as user \"" + System.getProperty("user.name")
|
||||||
+ "\" or run OpenVidu Server as superuser";
|
+ "\" or run OpenVidu Server as superuser";
|
||||||
log.error(errorMessage);
|
log.error(errorMessage);
|
||||||
log.error(
|
log.error("Be aware that a folder \"{}\" was created and should be manually deleted (\"sudo rm -rf {}\")",
|
||||||
"Be aware that a folder \"{}\" was created and should be manually deleted (\"sudo rm -rf {}\")",
|
|
||||||
testFolderPath, testFolderPath);
|
testFolderPath, testFolderPath);
|
||||||
throw new OpenViduException(Code.RECORDING_PATH_NOT_VALID, errorMessage);
|
throw new OpenViduException(Code.RECORDING_PATH_NOT_VALID, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Recording path successfully initialized at {}", this.openviduConfig.getOpenViduRecordingPath());
|
log.info("Recording path successfully initialized at {}", this.openviduConfig.getOpenViduRecordingPath());
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new OpenViduException(Code.RECORDING_PATH_NOT_VALID,
|
|
||||||
"The recording path '" + this.openviduConfig.getOpenViduRecordingPath() + "' is not valid. Reason: "
|
|
||||||
+ e.getClass().getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String finalReason(String reason) {
|
public static String finalReason(String reason) {
|
||||||
|
|
Loading…
Reference in New Issue