mirror of
https://github.com/wavetermdev/waveterm
synced 2026-05-04 22:19:00 +00:00
28 lines
723 B
TypeScript
28 lines
723 B
TypeScript
|
|
export const PlatformMacOS = "darwin";
|
||
|
|
export let PLATFORM: NodeJS.Platform = PlatformMacOS;
|
||
|
|
|
||
|
|
export function setPlatform(platform: NodeJS.Platform) {
|
||
|
|
PLATFORM = platform;
|
||
|
|
}
|
||
|
|
|
||
|
|
export function makeNativeLabel(isDirectory: boolean) {
|
||
|
|
let managerName: string;
|
||
|
|
if (!isDirectory) {
|
||
|
|
managerName = "Default Application";
|
||
|
|
} else if (PLATFORM === PlatformMacOS) {
|
||
|
|
managerName = "Finder";
|
||
|
|
} else if (PLATFORM == "win32") {
|
||
|
|
managerName = "Explorer";
|
||
|
|
} else {
|
||
|
|
managerName = "File Manager";
|
||
|
|
}
|
||
|
|
|
||
|
|
let fileAction: string;
|
||
|
|
if (isDirectory) {
|
||
|
|
fileAction = "Reveal";
|
||
|
|
} else {
|
||
|
|
fileAction = "Open File";
|
||
|
|
}
|
||
|
|
return `${fileAction} in ${managerName}`;
|
||
|
|
}
|