Make sure, the metadata file is set before other operations
This commit is contained in:
parent
88040e9a0b
commit
e39ff8d7d4
|
@ -58,10 +58,10 @@ public class RecordingManager {
|
||||||
public void saveRecording(Recording rec) throws UnsupportedEncodingException, IOException {
|
public void saveRecording(Recording rec) throws UnsupportedEncodingException, IOException {
|
||||||
String json = adapter.toJson(rec);
|
String json = adapter.toJson(rec);
|
||||||
File recordingsMetaDir = getDir();
|
File recordingsMetaDir = getDir();
|
||||||
Files.createDirectories(recordingsMetaDir.toPath());
|
|
||||||
String filename = rec.toString() + ".json";
|
String filename = rec.toString() + ".json";
|
||||||
File recordingMetaData = new File(recordingsMetaDir, filename);
|
File recordingMetaData = new File(recordingsMetaDir, filename);
|
||||||
rec.setMetaDataFile(recordingMetaData.getAbsolutePath());
|
rec.setMetaDataFile(recordingMetaData.getAbsolutePath());
|
||||||
|
Files.createDirectories(recordingsMetaDir.toPath());
|
||||||
Files.write(recordingMetaData.toPath(), json.getBytes("utf-8"), CREATE, WRITE, TRUNCATE_EXISTING);
|
Files.write(recordingMetaData.toPath(), json.getBytes("utf-8"), CREATE, WRITE, TRUNCATE_EXISTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public class RecordingManager {
|
||||||
recordings.add(recording);
|
recordings.add(recording);
|
||||||
} else {
|
} else {
|
||||||
LOG.info("Recording {} does not exist anymore -> deleting meta data", recording);
|
LOG.info("Recording {} does not exist anymore -> deleting meta data", recording);
|
||||||
Files.deleteIfExists(new File(recording.getMetaDataFile()).toPath());
|
Files.deleteIfExists(file.toPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue