This commit is contained in:
JellyBrick
2023-10-04 20:30:04 +09:00
parent 371a7eb475
commit 92a3a55803
4 changed files with 13 additions and 11 deletions

View File

@ -9,6 +9,7 @@ import getSongControls from '../../providers/song-controls';
import registerCallback, { SongInfo } from '../../providers/song-info';
import { changeProtocolHandler } from '../../providers/protocol-handler';
import { setTrayOnClick, setTrayOnDoubleClick } from '../../tray';
import { getMediaIconLocation } from '../utils';
let songControls: ReturnType<typeof getSongControls>;
let savedNotification: Notification | undefined;
@ -151,11 +152,6 @@ const getXml = (songInfo: SongInfo, iconSrc: string) => {
}
}
};
const iconLocation = app.isPackaged
? path.resolve(app.getPath('userData'), 'icons')
: path.resolve(__dirname, 'assets', 'media-icons-black');
const display = (kind: keyof typeof icons) => {
if (config.get('toastStyle') === ToastStyles.legacy) {
return `content="${icons[kind]}"`;
@ -163,7 +159,7 @@ const display = (kind: keyof typeof icons) => {
return `\
content="${config.get('hideButtonText') ? '' : kind.charAt(0).toUpperCase() + kind.slice(1)}"\
imageUri="file:///${path.resolve(__dirname, iconLocation, `${kind}.png`)}"
imageUri="file:///${path.resolve(getMediaIconLocation(), `${kind}.png`)}"
`;
};

View File

@ -7,6 +7,7 @@ import config from './config';
import { cache } from '../../providers/decorators';
import { SongInfo } from '../../providers/song-info';
import { getMediaIconLocation } from '../utils';
const icon = 'assets/youtube-music.png';
const userData = app.getPath('userData');
@ -88,10 +89,9 @@ export const saveTempIcon = () => {
continue;
}
const iconPath = path.resolve(__dirname, 'assets', 'media-icons-black', `${kind}.png`);
const iconPath = path.resolve(getMediaIconLocation(), `${kind}.png`);
fs.mkdirSync(path.dirname(destinationPath), { recursive: true });
fs.copyFile(iconPath, destinationPath, () => {
});
fs.copyFile(iconPath, destinationPath, () => {});
}
};