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

Accept std::filesystem::path in Database constructor #296

Closed
Chronial opened this issue Aug 31, 2020 · 3 comments
Closed

Accept std::filesystem::path in Database constructor #296

Chronial opened this issue Aug 31, 2020 · 3 comments
Assignees

Comments

@Chronial
Copy link

It would be helpful if SQLiteCpp would accept a std::filesystem::path as the database path.

That would shift some work from the users of the library to the library, since sqlitecpp would then have to take care of converting the path to utf8.

@sum01
Copy link
Contributor

sum01 commented Sep 2, 2020

That would require a minimum of C++17. I'm all for moving forward, but I would guess some might have a problem with that.

As an aside, it's worth pointing out that std::filesystem::path has a u8string() method, so there's no extra work to convert to u8.

@Chronial
Copy link
Author

Chronial commented Sep 3, 2020

That could easily be feature-guarded with the __cplusplus macro. This is already done in other places:

#if (__cplusplus >= 201402L) || ( defined(_MSC_VER) && (_MSC_VER >= 1900) ) // c++14: Visual Studio 2015

Nice point about the u8string, I had missed that method.

ptrks added a commit to ptrks/SQLiteCpp that referenced this issue Dec 30, 2020
@SRombauts SRombauts self-assigned this Jan 6, 2021
SRombauts pushed a commit that referenced this issue Jan 6, 2021
* Add Database constructor for filesystem::path #296

* Fixed incorrect MSVC version value for C++17

* Updated another incorrect version string

* Updated MSVC compiler check again. The <filesystem> header wasn't transitioned from std::experimental until MSVC 15.7

* Changed version check to look at c++ version no MSVC version
@SRombauts
Copy link
Owner

Thanks for asking, and many thanks to @ptrks for providing an implementation a few days ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants