Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added fix for windows-style network source-paths in dependencies parser #903

Merged
merged 2 commits into from
Jul 13, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions src/Paket.Core/PackageSources.fs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ let toBasicAuth = function
| ConfigAuthentication(username, password) ->
{Username = username; Password = password}

let tryParseWindowsStyleNetworkPath (path : string) =
let trimmed = path.TrimStart()
match Environment.OSVersion.Platform with
| PlatformID.Unix | PlatformID.MacOSX when trimmed.StartsWith @"\\" ->
trimmed.Replace('\\', '/') |> sprintf "smb:%s" |> Some
| _ -> None

type NugetSource =
{ Url : string
Authentication : NugetSourceAuthentication option }
Expand Down Expand Up @@ -91,11 +98,14 @@ type PackageSource =
PackageSource.Parse(source, parseAuth(line, source))

static member Parse(source,auth) =
match System.Uri.TryCreate(source, System.UriKind.Absolute) with
| true, uri -> if uri.Scheme = System.Uri.UriSchemeFile then LocalNuget(source) else Nuget({ Url = source; Authentication = auth })
| _ -> match System.Uri.TryCreate(source, System.UriKind.Relative) with
| true, uri -> LocalNuget(source)
| _ -> failwithf "unable to parse package source: %s" source
match tryParseWindowsStyleNetworkPath source with
| Some path -> PackageSource.Parse(path)
| _ ->
match System.Uri.TryCreate(source, System.UriKind.Absolute) with
| true, uri -> if uri.Scheme = System.Uri.UriSchemeFile then LocalNuget(source) else Nuget({ Url = source; Authentication = auth })
| _ -> match System.Uri.TryCreate(source, System.UriKind.Relative) with
| true, uri -> LocalNuget(source)
| _ -> failwithf "unable to parse package source: %s" source

member this.Url =
match this with
Expand Down