master
鲁誉程 9 months ago
parent 26597a470e
commit b14daae31c

@ -28,7 +28,7 @@ app.post('/createShortcut', (req, res) => {
// window下用.url // window下用.url
// const shortcutFilePath = path.join(folderPath, `${shortcutName}.url`); // const shortcutFilePath = path.join(folderPath, `${shortcutName}.url`);
// linux中用.desktop // linux中用.desktop
const shortcutFilePath = path.join(folderPath, `${shortcutName}test.desktop`); const shortcutFilePath = path.join(folderPath, `${shortcutName}.desktop`);
// 删除旧的快捷方式文件(如果存在) // 删除旧的快捷方式文件(如果存在)
if (fs.existsSync(shortcutFilePath)) { if (fs.existsSync(shortcutFilePath)) {
@ -40,12 +40,12 @@ app.post('/createShortcut', (req, res) => {
// const shortcutFileContent = `[InternetShortcut]\nURL=${shortcutURL}`; // const shortcutFileContent = `[InternetShortcut]\nURL=${shortcutURL}`;
// linux下创建快捷方式 // linux下创建快捷方式
const shortcutFolderPath = path.join(folderPath, `${shortcutName}test.desktop`); const shortcutFolderPath = path.join(folderPath, `${shortcutName}.desktop`);
const shortcutFileContent = `[Desktop Entry] const shortcutFileContent = `[Desktop Entry]
Type=Application Type=Application
Name=${shortcutName} Name=${shortcutName}
Exec=xdg-open ${shortcutURL} Exec=/usr/bin/chromium-browser ${shortcutURL}
Icon=chromium-browser`; Icon=Icon=/usr/share/icons/hicolor/48x48/apps/chromium-browser.png`;
fs.writeFile(shortcutFolderPath, shortcutFileContent, (err) => { fs.writeFile(shortcutFolderPath, shortcutFileContent, (err) => {
if (err) { if (err) {

Loading…
Cancel
Save