namespace StabilityMatrix.Core.Models.FileInterfaces; public partial class FilePath { /// /// Return a new with the given file name. /// public FilePath WithName(string fileName) { if ( Path.GetDirectoryName(FullPath) is { } directory && !string.IsNullOrWhiteSpace(directory) ) { return new FilePath(directory, fileName); } return new FilePath(fileName); } }