Griffin.WebServer
Griffin.WebServer copied to clipboard
IFileService should provide a method to see if a file exists
Having a IFileService.FileExists(Uri uri, string fileName)
method would allow re-using the IFileService
in the DefaultDocumentRouter
(instead of passing a root dir and duplicating the path calculation).
EDIT: The DiskFileService
implementation could look something like
/// <summary>
/// Check if the specified url is a directory and if it contains the specified file.
/// </summary>
/// <param name="uri">Uri</param>
/// <param name="fileName">File name</param>
/// <returns></returns>
public bool FileExists(Uri uri, string fileName)
{
if (fileName == null) return false;
var path = GetFullPath(uri);
if (!Directory.Exists(path)) return false;
return File.Exists(Path.Combine(path, fileName));
}
EDIT 2: Or have two methods
// Check if file or directory exists.
bool Exists(Uri uri);
// Check if uri is directory and contains given file.
bool Exists(Uri uri, string file);
Alternatively, adding GetFullPath
to the interface would solve the problem.
@wo80 Want to contribute to the project?
Haven't used this in a while. I was just cleaning up Github issues that seemed stale / not relevant anymore.
Sure I could do a pull request. But both this project and Griffin.Framework look abandoned. Do you have any plans to revive them?
I still use Griffin.Framework. working on a new and more modern networking layer in it (although slowly). also moving the data mapper to a separate repository.
Yeah, I saw the new_networking_code branch. Hope you find some time to finish this, looks promising!
I'll do the pull request, but since I don't have the framework targets for legacy net4 versions installed, I'd have to remove those from the project file.