mirror of
https://github.com/rubickCenter/rubick
synced 2025-07-18 13:27:25 +08:00
ref: 优化window读取系统应用icon展示
This commit is contained in:
parent
5118fa6ca4
commit
d047119076
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rubick2",
|
"name": "rubick2",
|
||||||
"version": "0.0.3-beta.14",
|
"version": "0.0.4",
|
||||||
"author": "muwoo <2424880409@qq.com>",
|
"author": "muwoo <2424880409@qq.com>",
|
||||||
"description": "An electron-vue project",
|
"description": "An electron-vue project",
|
||||||
"license": null,
|
"license": null,
|
||||||
@ -69,7 +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",
|
"extract-file-icon": "^0.3.2",
|
||||||
"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",
|
||||||
|
@ -3,8 +3,7 @@ import path from 'path';
|
|||||||
import os from 'os';
|
import os from 'os';
|
||||||
import translate from './translate';
|
import translate from './translate';
|
||||||
import {shell} from 'electron';
|
import {shell} from 'electron';
|
||||||
|
const fileIcon = require('extract-file-icon');
|
||||||
const fii = require('file-icon-info');
|
|
||||||
const filePath = path.resolve('C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs');
|
const filePath = path.resolve('C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs');
|
||||||
|
|
||||||
const fileLists = [];
|
const fileLists = [];
|
||||||
@ -15,16 +14,13 @@ const exists = fs.existsSync(icondir);
|
|||||||
if (!exists) { fs.mkdirSync(icondir) }
|
if (!exists) { fs.mkdirSync(icondir) }
|
||||||
|
|
||||||
const getico = app =>{
|
const getico = app =>{
|
||||||
fii.getIcon(app.desc, data => {
|
try {
|
||||||
let iconpath = path.join(icondir, `${app.name}.png`)
|
const buffer = fileIcon(app.desc, 32);
|
||||||
fs.exists(iconpath, exists => {
|
const iconpath = path.join(icondir, `${app.name}.png`);
|
||||||
if (!exists) {
|
fs.writeFileSync(iconpath, buffer, 'base64');
|
||||||
fs.writeFile(iconpath, data, 'base64', err => {
|
} catch(e) {
|
||||||
if (err) { console.log(err); }
|
console.log(e, app.desc);
|
||||||
})
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fileDisplay(filePath){
|
function fileDisplay(filePath){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user