summaryrefslogtreecommitdiff
path: root/std/_util/os.ts
blob: 3b56b6d8a1163933de08d83962a086e02492b7d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.

export const osType = (() => {
  if (globalThis.Deno != null) {
    return Deno.build.os;
  }

  // deno-lint-ignore no-explicit-any
  const navigator = (globalThis as any).navigator;
  if (navigator?.appVersion?.includes?.("Win") ?? false) {
    return "windows";
  }

  return "linux";
})();

export const isWindows = osType === "windows";