LocateFileFromDirectory(String) Method

Definition

Namespace CliInvoke
Assembly CliInvoke.dll

Locates filePathToResolve by recursing into the directory inferred from the path (or the current working directory when no directory can be inferred).

[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
protected virtual FileInfo LocateFileFromDirectory(string filePathToResolve)

Parameters

filePathToResolve
String

The file path to resolve.

Returns

FileInfo
The located FileInfo.

Remarks

For relative subpaths (e.g., "subdir/file.exe"), the directory component is inferred from the path itself. If the directory cannot be determined, the current working directory is used as a fallback. The method enumerates files in the inferred directory (no recursion) and matches by filename using platform-appropriate comparison: OrdinalIgnoreCase on Windows, Ordinal on Unix-like systems.