mirror of https://github.com/facebook/rocksdb.git
Make sure directory exists before attempting to write to it (#7090)
Summary: Closes https://github.com/facebook/rocksdb/issues/7053 Pull Request resolved: https://github.com/facebook/rocksdb/pull/7090 Reviewed By: riversand963 Differential Revision: D22481199 Pulled By: pdillinger fbshipit-source-id: 287477db94d57b18bee58189135f44936f1c3ca3
This commit is contained in:
parent
4924a506b9
commit
1a8ca6688a
|
@ -87,7 +87,12 @@ public class NativeLibraryLoader {
|
|||
if (tmpDir == null || tmpDir.isEmpty()) {
|
||||
temp = File.createTempFile(tempFilePrefix, tempFileSuffix);
|
||||
} else {
|
||||
temp = new File(tmpDir, jniLibraryFileName);
|
||||
final File parentDir = new File(tmpDir);
|
||||
if (!parentDir.exists()) {
|
||||
throw new RuntimeException(
|
||||
"Directory: " + parentDir.getAbsolutePath() + " does not exist!");
|
||||
}
|
||||
temp = new File(parentDir, jniLibraryFileName);
|
||||
if (temp.exists() && !temp.delete()) {
|
||||
throw new RuntimeException("File: " + temp.getAbsolutePath()
|
||||
+ " already exists and cannot be removed.");
|
||||
|
|
Loading…
Reference in New Issue