mirror of
https://github.com/rubickCenter/rubick
synced 2025-07-17 12:47:33 +08:00
bugfix: #44,支持windows应用图标展示
This commit is contained in:
parent
651e202ab1
commit
424c40a99c
@ -69,6 +69,7 @@
|
|||||||
"download-git-repo": "^3.0.2",
|
"download-git-repo": "^3.0.2",
|
||||||
"electron-is-dev": "^2.0.0",
|
"electron-is-dev": "^2.0.0",
|
||||||
"electron-store": "^8.0.0",
|
"electron-store": "^8.0.0",
|
||||||
|
"file-icon-info": "^1.1.1",
|
||||||
"iohook": "^0.9.3",
|
"iohook": "^0.9.3",
|
||||||
"is-chinese": "^1.4.2",
|
"is-chinese": "^1.4.2",
|
||||||
"jian-pinyin": "^0.2.3",
|
"jian-pinyin": "^0.2.3",
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import fs from 'fs';
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import child from 'child_process';
|
import child from 'child_process';
|
||||||
@ -7,6 +8,26 @@ import translate from "./translate";
|
|||||||
const fileLists = [];
|
const fileLists = [];
|
||||||
const isZhRegex = /[\u4e00-\u9fa5]/;
|
const isZhRegex = /[\u4e00-\u9fa5]/;
|
||||||
|
|
||||||
|
const getico = apps =>{
|
||||||
|
const fii = require('file-icon-info');
|
||||||
|
const icondir = path.join(os.tmpdir(), 'ProcessIcon');
|
||||||
|
const exists = fs.existsSync(icondir);
|
||||||
|
if (!exists) { fs.mkdirSync(icondir) }
|
||||||
|
|
||||||
|
apps.forEach((app, i) => {
|
||||||
|
fii.getIcon(app.desc, data => {
|
||||||
|
let iconpath = path.join(icondir, `${app.LegalName}.png`)
|
||||||
|
fs.exists(iconpath, exists => {
|
||||||
|
if (!exists) {
|
||||||
|
fs.writeFile(iconpath, data, "base64", err => {
|
||||||
|
if (err) { console.log(err); }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const powershell = (cmd, callback) => {
|
const powershell = (cmd, callback) => {
|
||||||
const ps = child.spawn('powershell', ['-NoProfile', '-Command', cmd], { encoding: 'buffer' })
|
const ps = child.spawn('powershell', ['-NoProfile', '-Command', cmd], { encoding: 'buffer' })
|
||||||
let chunks = [];
|
let chunks = [];
|
||||||
@ -71,6 +92,7 @@ const getWinAppList = () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
getico(fileLists);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user