Skip to content

Commit

Permalink
fix directory bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yehuozhili committed Aug 24, 2020
1 parent 59a70ff commit f6760f5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
5 changes: 1 addition & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ app.on("ready", () => {
);
});
autoUpdater.on("update-not-available", () => {
dialog.showMessageBox({
title: "没有新版本",
message: "当前已经是最新版本",
});
console.log("当前已经是最新版本");
});

autoUpdater.on("download-progress", (progressObj) => {
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "bigbear-mindmap",
"version": "0.1.1",
"private": true,
"version": "0.1.3",
"private": false,
"main": "main.js",
"author": "yehuozhili",
"description": "a mindmap build with electron",
"dependencies": {
"electron-is-dev": "^1.2.0",
"electron-store": "^6.0.0"
"electron-store": "^6.0.0",
"electron-updater": "^4.3.1"
},
"scripts": {
"start": "react-scripts start",
Expand Down Expand Up @@ -99,7 +100,6 @@
"react": "^16.13.1",
"react-dom": "^16.13.1",
"bigbear-ui": "^1.0.0",
"@antv/g6": "^3.6.1",
"electron-updater": "^4.3.1"
"@antv/g6": "^3.6.1"
}
}
11 changes: 7 additions & 4 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,21 @@ const importNewFile = (li) => {
const renameFile = (list, index, setList, v) => {
let origin = list[index];
let p = origin.path;
const newPath = origin.isNew ? join(savelocation, v) : join(dirname(p, v));
const newPath = origin.isNew
? join(savelocation, v)
: join(dirname(p, v), v);
try {
fs.statSync(p);
fs.renameSync(p, newPath);
let newlist = list;
newlist[index].title = v;
newlist[index].path = newPath;

setList([...newlist]);
saveFilesToStore([...newlist]);
} catch {
remote.dialog.showErrorBox(`文件不存在`, `${p}`);
} catch (e) {
console.log(e);
console.log(newPath);
remote.dialog.showErrorBox(`文件不存在或者操作不允许`, `${p}`);
}
};

Expand Down

0 comments on commit f6760f5

Please sign in to comment.