Skip to content

Commit a8e85fa

Browse files
authored
Merge pull request #137 from compnerd/windows-platform
TSCUtility: add `Windows` to the enumeration
2 parents 3299939 + 7907c66 commit a8e85fa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/TSCUtility/Platform.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public enum Platform: Equatable {
1616
case android
1717
case darwin
1818
case linux(LinuxFlavor)
19+
case windows
1920

2021
/// Recognized flavors of linux.
2122
public enum LinuxFlavor: Equatable {
@@ -27,6 +28,9 @@ public enum Platform: Equatable {
2728
public static var currentPlatform = Platform._findCurrentPlatform(localFileSystem)
2829
/// Attempt to match `uname` with recognized platforms.
2930
public static func _findCurrentPlatform(_ fs: FileSystem) -> Platform? {
31+
#if os(Windows)
32+
return .windows
33+
#else
3034
guard let uname = try? Process.checkNonZeroExit(args: "uname").spm_chomp().lowercased() else { return nil }
3135
switch uname {
3236
case "darwin":
@@ -36,6 +40,7 @@ public enum Platform: Equatable {
3640
default:
3741
return nil
3842
}
43+
#endif
3944
}
4045

4146
public static func _findCurrentPlatformLinux(_ fs: FileSystem) -> Platform? {

0 commit comments

Comments
 (0)