Created
August 9, 2022 15:45
-
-
Save JordanMarr/b8c66aa7d0ca790be8ddfcb0a1824a58 to your computer and use it in GitHub Desktop.
CurrentFile.fs Utility
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Utils | |
open System.IO | |
open System.Runtime.CompilerServices | |
type CurrentFile = | |
static member Path([<CallerFilePath>] ?file: string) = | |
file |> Option.defaultValue "" | |
static member Directory([<CallerFilePath>] ?file: string) = | |
file |> Option.defaultValue "" |> Path.GetDirectoryName | |
static member Relative(relative: string, [<CallerFilePath>] ?file: string) = | |
let directory = file |> Option.defaultValue "" |> Path.GetDirectoryName | |
Path.Combine(directory, relative) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment