From 32bb15c4bfc8210c227465dc83fa83c002838ddb Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Tue, 22 Aug 2023 19:35:31 +0800 Subject: [PATCH] WIP move 2 --- Fsdk/Git.fs | 2 +- Fsdk/Misc.fs | 10 +++++----- Fsdk/Network.fs | 2 +- Fsdk/Process.fs | 4 ++-- fsxc/Fsxc.fs | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Fsdk/Git.fs b/Fsdk/Git.fs index d3c32293..c44e1232 100644 --- a/Fsdk/Git.fs +++ b/Fsdk/Git.fs @@ -25,7 +25,7 @@ module Git = let private IsGitInstalled() : bool = let gitCheckCommand = match Misc.GuessPlatform() with - | Misc.Platform.Windows -> + | Platform.Windows -> { Command = "git" Arguments = "--version" diff --git a/Fsdk/Misc.fs b/Fsdk/Misc.fs index 16909849..c8c38c7f 100644 --- a/Fsdk/Misc.fs +++ b/Fsdk/Misc.fs @@ -21,6 +21,11 @@ type ArgsParsed = | OnlyFlags of seq | BothFlags of seq*string*seq +type Platform = + | Windows + | Linux + | Mac + module Misc = @@ -192,11 +197,6 @@ module Misc = str.Split([| separator |], StringSplitOptions.RemoveEmptyEntries) ) - type Platform = - | Windows - | Linux - | Mac - // FIXME: maybe get rid of this method when we migrate to .NET6 (or earlier) // because it seems it's unnecessary (e.g. see https://gitlab.com/nblockchain/geewallet/-/merge_requests/140 ) let GuessPlatform() = diff --git a/Fsdk/Network.fs b/Fsdk/Network.fs index fe1a2098..6329619c 100644 --- a/Fsdk/Network.fs +++ b/Fsdk/Network.fs @@ -441,7 +441,7 @@ module Network = let internal CreateNugetCommand (nugetExe: FileInfo) (args: string) = let platform = Misc.GuessPlatform() - if platform = Misc.Platform.Windows then + if platform = Platform.Windows then { Command = nugetExe.FullName Arguments = args diff --git a/Fsdk/Process.fs b/Fsdk/Process.fs index 58123cbd..82dc2ff9 100644 --- a/Fsdk/Process.fs +++ b/Fsdk/Process.fs @@ -435,7 +435,7 @@ module Process = paths.Any(fun path -> File.Exists(Path.Combine(path, command))) let CommandWorksInShell(command: string) : bool = - if (Misc.GuessPlatform() = Misc.Platform.Windows) then + if (Misc.GuessPlatform() = Platform.Windows) then let exists = File.Exists(command) || IsFileInWindowsPath(command) if (exists && HasWindowsExecutableExtension(command)) then @@ -499,7 +499,7 @@ module Process = // FIXME: it returns the first result, but we should return all (array) let VsWhere(searchPattern: string) : Option = - if Misc.GuessPlatform() <> Misc.Platform.Windows then + if Misc.GuessPlatform() <> Platform.Windows then failwith "vswhere.exe doesn't exist in other platforms than Windows" let programFiles = diff --git a/fsxc/Fsxc.fs b/fsxc/Fsxc.fs index da4f7f08..f1a0804e 100644 --- a/fsxc/Fsxc.fs +++ b/fsxc/Fsxc.fs @@ -805,7 +805,7 @@ let fsi = { CommandLineArgs = System.Environment.GetCommandLineArgs() } "dotnet" #else match Misc.GuessPlatform() with - | Misc.Platform.Windows -> + | Platform.Windows -> match Process.VsWhere "**\\fsc.exe" with | None -> failwith "fsc.exe not found" | Some fscExe -> fscExe