From b53a9eac4228cd6544eb8d4d024f13912049fbb6 Mon Sep 17 00:00:00 2001 From: krauthaufen Date: Thu, 25 Jun 2015 11:20:59 +0200 Subject: [PATCH 1/2] added fix for windows-style network source-paths in dependencies parser; --- src/Paket.Core/PackageSources.fs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Paket.Core/PackageSources.fs b/src/Paket.Core/PackageSources.fs index 5abb5a951e..b559db4e5e 100644 --- a/src/Paket.Core/PackageSources.fs +++ b/src/Paket.Core/PackageSources.fs @@ -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 } @@ -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 -> LocalNuget(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 From e38ba112476734a90edfa72c38730d6c15fab0d1 Mon Sep 17 00:00:00 2001 From: krauthaufen Date: Thu, 25 Jun 2015 11:29:05 +0200 Subject: [PATCH 2/2] fixed Parse (now working) --- src/Paket.Core/PackageSources.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Paket.Core/PackageSources.fs b/src/Paket.Core/PackageSources.fs index b559db4e5e..eefb44d449 100644 --- a/src/Paket.Core/PackageSources.fs +++ b/src/Paket.Core/PackageSources.fs @@ -99,7 +99,7 @@ type PackageSource = static member Parse(source,auth) = match tryParseWindowsStyleNetworkPath source with - | Some path -> LocalNuget(path) + | 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 })