Files
gitea-repo-config/Gitea.Declarative.Test/Utils.fs
2022-12-30 10:26:59 +00:00

18 lines
437 B
Forth

namespace Gitea.Declarative.Test
open System.IO
[<RequireQualifiedAccess>]
module Utils =
let rec findFileAbove (fileName : string) (di : DirectoryInfo) =
if isNull di then
failwith "hit the root without finding anything"
let candidate = Path.Combine (di.FullName, fileName) |> FileInfo
if candidate.Exists then
candidate
else
findFileAbove fileName di.Parent