Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IFileService should provide a method to see if a file exists #24

Open
wo80 opened this issue Oct 24, 2015 · 4 comments
Open

IFileService should provide a method to see if a file exists #24

wo80 opened this issue Oct 24, 2015 · 4 comments

Comments

@wo80
Copy link
Contributor

wo80 commented Oct 24, 2015

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 wo80 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 13, 2023
@jgauffin
Copy link
Owner

@wo80 Want to contribute to the project?

@wo80
Copy link
Contributor Author

wo80 commented Sep 15, 2023

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?

@jgauffin
Copy link
Owner

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.

@wo80
Copy link
Contributor Author

wo80 commented Sep 15, 2023

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.

@wo80 wo80 reopened this Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants