You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
508 B
21 lines
508 B
1 year ago
|
namespace StabilityMatrix.Core.Models.FileInterfaces;
|
||
|
|
||
|
public partial class FilePath
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// Return a new <see cref="FilePath"/> with the given file name.
|
||
|
/// </summary>
|
||
|
public FilePath WithName(string fileName)
|
||
|
{
|
||
|
if (
|
||
|
Path.GetDirectoryName(FullPath) is { } directory
|
||
|
&& !string.IsNullOrWhiteSpace(directory)
|
||
|
)
|
||
|
{
|
||
|
return new FilePath(directory, fileName);
|
||
|
}
|
||
|
|
||
|
return new FilePath(fileName);
|
||
|
}
|
||
|
}
|