Skip to content

Commit

Permalink
Merge pull request #2700 from nickgravgaard/use-path-for-sqlpackage-o…
Browse files Browse the repository at this point in the history
…n-unix

On Unix like OSs, look for sqlpackage in directories specified in $PATH
  • Loading branch information
yazeedobaid authored Oct 21, 2022
2 parents 37fab34 + f275631 commit effecbf
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/app/Fake.Sql.SqlPackage/Sql.SqlPackage.fs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ module SqlPackage =

let internal validPaths =
let paths = [
let macOrLinux = Set [ PlatformID.MacOSX; PlatformID.Unix ]
if macOrLinux.Contains Environment.OSVersion.Platform then
!!"/usr/local/bin/sqlpackage"
|> Seq.map (fun path -> path, 15)
if Environment.isUnix then
Seq.append Environment.pathDirectories ["/usr/local/bin"; "/usr/bin"] |> Seq.map (fun dir -> !!(dir </> "sqlpackage")) |> Seq.concat |> Seq.map (fun path -> path, 15)
else
let getSqlVersion (path:string) = path.Split '\\' |> Array.item 3 |> int
let getVsVersion (path: string) = (Path.GetDirectoryName path |> DirectoryInfo).Name |> int
Expand Down Expand Up @@ -210,4 +208,3 @@ module SqlPackage =
data)
|> Proc.run
|> ignore

0 comments on commit effecbf

Please sign in to comment.