update to v1.2.0 细节修复

This commit is contained in:
kohgylw 2023-12-29 22:51:45 +08:00
parent 4a5ef18125
commit 620698e384
8 changed files with 64 additions and 44 deletions

View File

@ -107,6 +107,8 @@ public class ConfigureReader {
private boolean enableWebDAV = true;// 是否启用WebDAV功能
private String recycleBinPath;// 删除留档路径
private boolean tempDirIsInit = false;
private static final int MAX_EXTENDSTORES_NUM = 255;// 扩展存储区最大数目
private static final String[] SYS_ACCOUNTS = { "SYS_IN", "Anonymous", "匿名用户" };// 一些系统的特殊账户
@ -731,14 +733,19 @@ public class ConfigureReader {
return CANT_CREATE_FILE_NODE_PATH;
}
this.TFPath = this.fileSystemPath + "temporaryfiles" + File.separator;
if (!initTempDir()) {
Printer.instance.print("错误:无法创建临时文件存放区[" + this.TFPath + "]。");
return CANT_CREATE_TF_PATH;
if (!tempDirIsInit) {
// 如果临时文件夹尚未初始化则对其进行初始化
if (!initTempDir()) {
Printer.instance.print("错误:无法创建临时文件存放区[" + this.TFPath + "]。");
return CANT_CREATE_TF_PATH;
}
// 退出程序时自动初始化清理临时文件夹
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
initTempDir();
}));
// 标识临时文件夹已经初始化无需再次初始化
tempDirIsInit = true;
}
// 退出程序时自动初始化清理临时文件夹
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
initTempDir();
}));
if ("true".equals(serverp.getProperty("mysql.enable"))) {
dbDriver = "com.mysql.cj.jdbc.Driver";
String url = serverp.getProperty("mysql.url", "127.0.0.1/kift");

View File

@ -14,6 +14,7 @@ import java.awt.dnd.DropTargetListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
@ -197,18 +198,21 @@ public class FSViewer extends KiftdDynamicWindow {
fsd.show();
});
t.start();
SwingUtilities.invokeLater(() -> {
try {
FileSystemManager.getInstance().exportTo(folders, nodes, path, type);
try {
FileSystemManager.getInstance().exportTo(folders, nodes, path, type);
SwingUtilities.invokeLater(() -> {
fsd.close();
} catch (Exception e1) {
});
} catch (Exception e1) {
SwingUtilities.invokeLater(() -> {
fsd.close();
Printer.instance.print(e1.toString());
JOptionPane.showMessageDialog(window, "导出文件时失败,该操作已被中断,未能全部导出。", "错误",
JOptionPane.ERROR_MESSAGE);
}
refresh();
enableAllButtons();
});
});
}
refresh();
enableAllButtons();
});
}
});
@ -233,19 +237,22 @@ public class FSViewer extends KiftdDynamicWindow {
fsd.show();
});
t.start();
SwingUtilities.invokeLater(() -> {
try {
FileSystemManager.getInstance().delete(selectedFolders.toArray(new String[0]),
selectedNodes.toArray(new String[0]));
try {
FileSystemManager.getInstance().delete(selectedFolders.toArray(new String[0]),
selectedNodes.toArray(new String[0]));
SwingUtilities.invokeLater(() -> {
fsd.close();
} catch (Exception e1) {
});
} catch (Exception e1) {
SwingUtilities.invokeLater(() -> {
fsd.close();
Printer.instance.print(e1.toString());
JOptionPane.showMessageDialog(window, "删除文件时失败,该操作已被中断,未能全部删除。", "错误",
JOptionPane.ERROR_MESSAGE);
}
refresh();
enableAllButtons();
});
});
}
refresh();
enableAllButtons();
});
} else {
enableAllButtons();
@ -323,26 +330,33 @@ public class FSViewer extends KiftdDynamicWindow {
fsd.show();
});
t.start();
SwingUtilities.invokeLater(() -> {
try {
boolean exportSuccess = FileSystemManager.getInstance().exportTo(
new String[0], new String[] { n.getFileId() }, previewDir,
null);
try {
boolean exportSuccess = FileSystemManager.getInstance().exportTo(
new String[0], new String[] { n.getFileId() }, previewDir, null);
SwingUtilities.invokeLater(() -> {
fsd.close();
if (exportSuccess) {
// 如果导出成功将此文件设置为只读并以系统默认方式打开
File pf = new File(previewDir, n.getFileName());
if (pf.isFile() && pf.setReadOnly()) {
Desktop.getDesktop().open(pf);
try {
Desktop.getDesktop().open(pf);
} catch (IOException e1) {
Printer.instance.print(e1.toString());
JOptionPane.showMessageDialog(window, "无法预览此文件。", "错误",
JOptionPane.ERROR_MESSAGE);
}
}
}
} catch (Exception e1) {
});
} catch (Exception e1) {
SwingUtilities.invokeLater(() -> {
fsd.close();
Printer.instance.print(e1.toString());
JOptionPane.showMessageDialog(window, "导出文件时失败,该操作已被中断,未能全部导出。", "错误",
JOptionPane.ERROR_MESSAGE);
}
});
});
}
}
}
}
@ -508,17 +522,16 @@ public class FSViewer extends KiftdDynamicWindow {
fsd.show();
});
t.start();
try {
FileSystemManager.getInstance().importFrom(files, folderId, type);
} catch (FoldersTotalOutOfLimitException e1) {
JOptionPane.showMessageDialog(window, "导入失败,该文件夹内的文件夹数目已达上限,无法导入更多文件夹。", "错误", JOptionPane.ERROR_MESSAGE);
} catch (FilesTotalOutOfLimitException e2) {
JOptionPane.showMessageDialog(window, "导入失败,该文件夹内的文件数目已达上限,无法导入更多文件。", "错误", JOptionPane.ERROR_MESSAGE);
} catch (Exception e3) {
JOptionPane.showMessageDialog(window, "导入失败,无法完成导入,该操作已被中断。", "错误", JOptionPane.ERROR_MESSAGE);
}
SwingUtilities.invokeLater(() -> {
try {
FileSystemManager.getInstance().importFrom(files, folderId, type);
} catch (FoldersTotalOutOfLimitException e1) {
JOptionPane.showMessageDialog(window, "导入失败,该文件夹内的文件夹数目已达上限,无法导入更多文件夹。", "错误",
JOptionPane.ERROR_MESSAGE);
} catch (FilesTotalOutOfLimitException e2) {
JOptionPane.showMessageDialog(window, "导入失败,该文件夹内的文件数目已达上限,无法导入更多文件。", "错误", JOptionPane.ERROR_MESSAGE);
} catch (Exception e3) {
JOptionPane.showMessageDialog(window, "导入失败,无法完成导入,该操作已被中断。", "错误", JOptionPane.ERROR_MESSAGE);
}
fsd.close();
refresh();
});

View File

@ -1,5 +1,5 @@
#Generated by Maven Integration for Eclipse
#Fri Dec 29 21:12:51 CST 2023
#Fri Dec 29 22:48:20 CST 2023
m2e.projectLocation=/Users/kohgylw/Programs/java_workspace/kiftd
m2e.projectName=kiftd
groupId=kohgylw