Open losingmap opened 1 year ago
移动文件之后路径不会改变,可以考虑监听文件移动的事件来更改文件地址 public class NotesVirtualFileListener implements VirtualFileListener { @Override public void fileMoved(@NotNull VirtualFileMoveEvent event) { String fileName = event.getFileName(); String oldPath = event.getOldParent().getPath() + "/" + fileName; String newPath = event.getNewParent().getPath() + "/" + fileName; ConnectSQLite.executeSql("update favorite_leaf\n" + "set url = '" + newPath + "'\n" + "where url = '" + oldPath + "'"); } }
注册监听事件 VirtualFileManager.getInstance().addVirtualFileListener(new NotesVirtualFileListener());
哇,核心代码都写了 万分感谢 尽快开发上线
期待ing ^_^
移动文件之后路径不会改变,可以考虑监听文件移动的事件来更改文件地址 public class NotesVirtualFileListener implements VirtualFileListener { @Override public void fileMoved(@NotNull VirtualFileMoveEvent event) { String fileName = event.getFileName(); String oldPath = event.getOldParent().getPath() + "/" + fileName; String newPath = event.getNewParent().getPath() + "/" + fileName; ConnectSQLite.executeSql("update favorite_leaf\n" + "set url = '" + newPath + "'\n" + "where url = '" + oldPath + "'"); } }
注册监听事件 VirtualFileManager.getInstance().addVirtualFileListener(new NotesVirtualFileListener());