Skip to content

Commit f14a3e6

Browse files
committed
use const, make platfomutil consistent across tsunami
1 parent b5ebb4e commit f14a3e6

2 files changed

Lines changed: 10 additions & 19 deletions

File tree

frontend/util/platformutil.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright 2025, Command Line Inc.
2+
// SPDX-License-Identifier: Apache-2.0
3+
14
export const PlatformMacOS = "darwin";
25
export const PlatformWindows = "win32";
36
export let PLATFORM: NodeJS.Platform = PlatformMacOS;
@@ -20,7 +23,7 @@ export function makeNativeLabel(isDirectory: boolean) {
2023
managerName = "Default Application";
2124
} else if (PLATFORM === PlatformMacOS) {
2225
managerName = "Finder";
23-
} else if (PLATFORM == "win32") {
26+
} else if (PLATFORM == PlatformWindows) {
2427
managerName = "Explorer";
2528
} else {
2629
managerName = "File Manager";

tsunami/frontend/src/util/platformutil.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,17 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
export const PlatformMacOS = "darwin";
5+
export const PlatformWindows = "win32";
56
export let PLATFORM: NodeJS.Platform = PlatformMacOS;
67

78
export function setPlatform(platform: NodeJS.Platform) {
89
PLATFORM = platform;
910
}
1011

11-
export function makeNativeLabel(isDirectory: boolean) {
12-
let managerName: string;
13-
if (!isDirectory) {
14-
managerName = "Default Application";
15-
} else if (PLATFORM === PlatformMacOS) {
16-
managerName = "Finder";
17-
} else if (PLATFORM == "win32") {
18-
managerName = "Explorer";
19-
} else {
20-
managerName = "File Manager";
21-
}
12+
export function isMacOS(): boolean {
13+
return PLATFORM == PlatformMacOS;
14+
}
2215

23-
let fileAction: string;
24-
if (isDirectory) {
25-
fileAction = "Reveal";
26-
} else {
27-
fileAction = "Open File";
28-
}
29-
return `${fileAction} in ${managerName}`;
16+
export function isWindows(): boolean {
17+
return PLATFORM == PlatformWindows;
3018
}

0 commit comments

Comments
 (0)