提交 990ae118 authored 作者: Thomas Mueller's avatar Thomas Mueller

MVStore: use NIO even in Windows when using a file name with drive name.

上级 b5f31478
...@@ -14,6 +14,7 @@ import java.nio.channels.OverlappingFileLockException; ...@@ -14,6 +14,7 @@ import java.nio.channels.OverlappingFileLockException;
import org.h2.mvstore.cache.FilePathCache; import org.h2.mvstore.cache.FilePathCache;
import org.h2.store.fs.FilePath; import org.h2.store.fs.FilePath;
import org.h2.store.fs.FilePathDisk;
import org.h2.store.fs.FilePathEncrypt; import org.h2.store.fs.FilePathEncrypt;
import org.h2.store.fs.FilePathNio; import org.h2.store.fs.FilePathNio;
...@@ -111,11 +112,13 @@ public class FileStore { ...@@ -111,11 +112,13 @@ public class FileStore {
* used * used
*/ */
public void open(String fileName, boolean readOnly, char[] encryptionKey) { public void open(String fileName, boolean readOnly, char[] encryptionKey) {
if (fileName != null && fileName.indexOf(':') < 0) { if (fileName != null) {
// NIO is used, unless a different file system is specified if (FilePath.get(fileName) instanceof FilePathDisk) {
// the following line is to ensure the NIO file system is compiled // NIO is used, unless a different file system is specified
FilePathNio.class.getName(); // the following line is to ensure the NIO file system is compiled
fileName = "nio:" + fileName; FilePathNio.class.getName();
fileName = "nio:" + fileName;
}
} }
this.fileName = fileName; this.fileName = fileName;
FilePath f = FilePath.get(fileName); FilePath f = FilePath.get(fileName);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论