waveterm/frontend/util/platformutil.ts
Sylvie Crowe ff4b71dfae
Error Popups and Context Menu Items (#1989)
This makes the following changes:
- Connects various context menu items to the error overlay on failure
- Connects read file errors to the error overlay on failure
- Consolidates context menu items for open and reveal
- Reduces duplication in context menu items
- Removes an unnecessary File Stat RPC call for the parent directory

---------

Co-authored-by: Evan Simkowitz <esimkowitz@users.noreply.github.com>
Co-authored-by: sawka <mike@commandline.dev>
2025-02-18 16:25:03 -08:00

27 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}`;
}