File name, extension fix

This commit is contained in:
2022-02-13 13:42:48 +01:00
parent ec03067af1
commit 48926e0f17

View File

@@ -54,13 +54,13 @@ namespace FileTime.Avalonia.Services
{
var parts = fullName.Split('.');
var fileName = string.Join('.', parts[..^1]);
return fileName == "." ? fullName : fileName;
return string.IsNullOrEmpty(fileName) ? fullName : fileName;
}
public string GetFileExtension(string fullName)
{
var parts = fullName.Split('.');
return parts.Length > 1 ? parts[^1] : "";
return parts.Length == 1 || (parts.Length == 2 && string.IsNullOrEmpty(parts[0])) ? "" : parts[^1];
}
}
}