Skip to content

Commit

Permalink
#76: Rename OperatingSystemName to PlatformId.
Browse files Browse the repository at this point in the history
  • Loading branch information
Taitava committed Oct 23, 2021
1 parent 02aed9e commit c4175d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/Common.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {App, Editor, FileSystemAdapter, MarkdownView, normalizePath} from "obsidian";
import {OperatingSystemName} from "./settings/ShellCommandsPluginSettings";
import {PlatformId} from "./settings/ShellCommandsPluginSettings";
import {platform} from "os";

export function getVaultAbsolutePath(app: App) {
Expand All @@ -20,9 +20,10 @@ export function isWindows() {
}

/**
* This is just a wrapper around platform() in order to cast the type to OperatingSystemName.
* This is just a wrapper around platform() in order to cast the type to PlatformId.
* TODO: Consider renaming this to getPlatformId().
*/
export function getOperatingSystem(): OperatingSystemName {
export function getOperatingSystem(): PlatformId {
// @ts-ignore In theory, platform() can return an OS name not included in OperatingSystemName. But as Obsidian
// currently does not support anything else than Windows, Mac and Linux (except mobile platforms, but they are
// ruled out by the manifest of this plugin), it should be safe to assume that the current OS is one of those
Expand Down
2 changes: 1 addition & 1 deletion src/settings/ShellCommandsPluginSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const DEFAULT_SETTINGS: ShellCommandsPluginSettings = {
*
* @see NodeJS.Platform
*/
export type OperatingSystemName = "darwin" | "linux" | "win32";
export type PlatformId = "darwin" | "linux" | "win32";

/**
* All OSes supported by the Shell commands plugin.
Expand Down

0 comments on commit c4175d3

Please sign in to comment.