Skip to content

Commit 65e8edd

Browse files
committed
Splitting up exclusion pattern paths no considers other platform seperators.
1 parent 409d36e commit 65e8edd

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

‎src/Paket.Core/NupkgWriter.fs‎

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,21 +201,32 @@ let Write (core : CompleteCoreInfo) optional workingDir outputDir =
201201
let fixRelativePath (p:string) =
202202
let isWinDrive = Regex(@"^\w:\\.*", RegexOptions.Compiled).IsMatch
203203
let isNixRoot = Regex(@"^\/.*", RegexOptions.Compiled).IsMatch
204+
205+
printfn "fixRelativePath: %s" p
206+
printfn "isWinDrive: %A" <| isWinDrive p
207+
printfn "isNixRoot: %A" <| isNixRoot p
208+
204209
let prepend,path =
205210
match p with
206211
| s when isWinDrive s -> [|s.Substring(0,3)|],s.Substring(3)
207212
| s when isNixRoot s -> [|"/"|],s.Substring(1)
208213
| s when String.IsNullOrWhiteSpace s -> failwith "Empty exclusion path!"
209214
| s -> [||],s
210215

211-
path.Split(Path.DirectorySeparatorChar)
212-
|> Array.fold (fun (xs:string []) x ->
213-
match x with
214-
| s when "..".Equals s -> Array.sub xs 0 (xs.Length-1)
215-
| s when ".".Equals s -> xs
216-
| _ -> Array.append xs [|x|]) [||]
217-
|> Array.append prepend
218-
|> Array.fold (fun p' x -> Path.Combine(p',x)) ""
216+
printfn "storePrefix: %A , %s" prepend path
217+
218+
let transformed = path.Split('\\','/')
219+
|> Array.fold (fun (xs:string []) x ->
220+
match x with
221+
| s when "..".Equals s -> Array.sub xs 0 (xs.Length-1)
222+
| s when ".".Equals s -> xs
223+
| _ -> Array.append xs [|x|]) [||]
224+
|> Array.append prepend
225+
|> Array.fold (fun p' x -> Path.Combine(p',x)) ""
226+
227+
printfn "transormed: %A" transformed
228+
229+
transformed
219230

220231
let exclusions =
221232
optional.FilesExcluded

0 commit comments

Comments
 (0)