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