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

Poco::Path::forDirectory("C:") throws if the path is disk-letter only #4680

Closed
aleks-f opened this issue Sep 12, 2024 Discussed in #4573 · 0 comments · Fixed by #4679
Closed

Poco::Path::forDirectory("C:") throws if the path is disk-letter only #4680

aleks-f opened this issue Sep 12, 2024 Discussed in #4573 · 0 comments · Fixed by #4679

Comments

@aleks-f
Copy link
Member

aleks-f commented Sep 12, 2024

Discussed in #4573

Originally posted by siren186 May 21, 2024
Is your feature request related to a problem? Please describe.

Poco::Path::forDirectory("G:\\abc\\"); // OK
Poco::Path::forDirectory("G:\\abc"); // OK
Poco::Path::forDirectory("G:\\"); // OK
Poco::Path::forDirectory("G:"); // Poco::PathSyntaxException


// Why not auto add backslash for directories
// If I use Poco::Path, I have to do something else like this:
std::string str = "G:";
if (!str.ends_with('\\'))
{
    str.push_back('\\'); // To ensure Poco::Path not crash for me
}
Poco::Path::forDirectory(str);

Describe the solution you'd like

// If Poco::Path can auto add backslash for me, It can make my code looks more clean.
std::string str = "G:";
Poco::Path::forDirectory(str); // Please do not throw any exception

Describe alternatives you've considered

Or Poco can add some methods just like Windows API PathAddBackslash do

LPWSTR PathAddBackslashW(
  [in, out] LPWSTR pszPath
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant