-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileService.cs
More file actions
25 lines (21 loc) · 885 Bytes
/
Copy pathFileService.cs
File metadata and controls
25 lines (21 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
namespace SecureTPMVault;
internal static class FileService
{
/// <summary>
/// Resolves the full path for a given input path.
/// If the path is empty, returns the default path.
/// If the extension is missing, appends the default extension.
/// </summary>
/// <param name="inputPath">The user provided path or filename.</param>
/// <returns>The absolute file path.</returns>
public static string ResolvePath(string? inputPath)
{
if (string.IsNullOrWhiteSpace(inputPath))
return Path.Combine(AppConstants.ThisExeFolder, AppConstants.DefaultEncryptedFile);
if (!Path.HasExtension(inputPath))
inputPath += AppConstants.FileExtension;
if (!Path.IsPathFullyQualified(inputPath))
inputPath = Path.Combine(AppConstants.ThisExeFolder, inputPath);
return inputPath;
}
}