TryResolveFilePath(String, out FileInfo?) Method

Definition

Namespace CliInvoke.Core
Assembly CliInvoke.Core.dll

Attempts to resolve a file path by checking if the file path exists or if it's a directory, without throwing on failure.

[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
bool TryResolveFilePath(string filePathToResolve, scoped out FileInfo? resolvedFilePath)

Parameters

filePathToResolve
String

The file path to resolve.

resolvedFilePath
FileInfo

When this method returns, contains the resolved FileInfo if the file was found; otherwise, null.

Returns

Boolean
true if the file path was resolved successfully; otherwise, false.

Remarks

On success, resolvedFilePath is set to the resolved FileInfo and the method returns true. On failure, resolvedFilePath is set to null and the method returns false. This method does not throw when the file cannot be resolved.