提交 fdb0cc8d 编写于 作者: S ShadelessFox

#9911 Better checking for folder existence

上级 e7fcc6ed
......@@ -18,6 +18,7 @@
package org.jkiss.dbeaver.tasks.nativetool;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.preferences.DBPPreferenceStore;
import org.jkiss.dbeaver.model.runtime.DBRRunnableContext;
import org.jkiss.dbeaver.model.struct.DBSObject;
......@@ -27,6 +28,7 @@ import org.jkiss.utils.CommonUtils;
import java.io.File;
public abstract class AbstractImportExportSettings<BASE_OBJECT extends DBSObject> extends AbstractNativeToolSettings<BASE_OBJECT> {
private static final Log log = Log.getLog(AbstractImportExportSettings.class);
private File outputFolder;
private String outputFilePattern;
......@@ -58,8 +60,16 @@ public abstract class AbstractImportExportSettings<BASE_OBJECT extends DBSObject
if (CommonUtils.isEmpty(this.outputFilePattern)) {
this.outputFilePattern = "dump-${database}-${timestamp}.sql";
}
this.outputFolder = new File(CommonUtils.toString(store.getString("export.outputFolder")));
if (!this.outputFolder.exists()) {
String outputFolderPath = CommonUtils.toString(store.getString("export.outputFolder"));
if (CommonUtils.isNotEmpty(outputFolderPath)) {
File outputFolder = new File(outputFolderPath);
if (outputFolder.exists()) {
this.outputFolder = outputFolder;
} else {
log.warn("Output directory does not exists, using user home directory instead");
}
}
if (this.outputFolder == null) {
this.outputFolder = new File(RuntimeUtils.getUserHomeDir().getAbsolutePath());
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册