Skip to content

Commit

Permalink
Merge pull request #409 from fsprojects/Reffind
Browse files Browse the repository at this point in the history
Find the references file in upper directories
  • Loading branch information
mexx committed Dec 1, 2014
2 parents c7721e7 + f221d5c commit a3b570a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Paket.Core/ProjectFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,15 @@ type ProjectFile =
static member FindReferencesFile (projectFile : FileInfo) =
let specificReferencesFile = FileInfo(Path.Combine(projectFile.Directory.FullName, projectFile.Name + "." + Constants.ReferencesFile))
if specificReferencesFile.Exists then Some specificReferencesFile.FullName
else
let generalReferencesFile = FileInfo(Path.Combine(projectFile.Directory.FullName, Constants.ReferencesFile))
if generalReferencesFile.Exists then Some generalReferencesFile.FullName
else None
else
let rec findInDir (currentDir:DirectoryInfo) =
let generalReferencesFile = FileInfo(Path.Combine(currentDir.FullName, Constants.ReferencesFile))
if generalReferencesFile.Exists then Some generalReferencesFile.FullName
elif (FileInfo(Path.Combine(currentDir.FullName, Constants.DependenciesFileName))).Exists then None
elif currentDir.Parent = null then None
else findInDir currentDir.Parent

findInDir projectFile.Directory

member this.CreateNode(name) =
this.Document.CreateElement(name, Constants.ProjectDefaultNameSpace)
Expand Down

0 comments on commit a3b570a

Please sign in to comment.