Skip to content

Commit 3c01ba2

Browse files
authored
Stop trying to use std::filesystem. (#1109)
There were problems with this that I couldn't figure out, and from more reading, I get the impression that there's nobody designing it who does know exactly how it's supposed to work. There's no magic solution to portability problems there, just new and unknown intricacies to replace the old, somewhat-known ones.
1 parent 3c280be commit 3c01ba2

File tree

10 files changed

+5
-113
lines changed

10 files changed

+5
-113
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
8.0.0-rc4
22
- Release candidate for 8.0.0.
33
- Any changes will be logged under "8.0.0".
4+
- Stop trying to use/support `std::filesystem`.
45
8.0.0
56
- C++20 is now the oldest C++ version that libpqxx supports.
67
- **Result/row iterators have changed.** Instead of `i[n]` do `(*i)[n]`.

UPGRADING.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,11 @@ All shell scripts now have a `.sh` suffix. It takes some getting used to, but
321321
it simplifies some things such as running lint checkers on all of them without
322322
having to name each one of them individually.
323323

324-
The build no longer tries to figure out whether it needs to link a standard C++
324+
The build no longer tries to figure out whether you need to link a standard C++
325325
filesystems library. In most cases this seems to be part of the regular
326-
standard library now. If you do need to add a link option to get
327-
`std::filesystem` to work, you'll have to pass that option yourself.
326+
standard library now, and at any rate libpqxx itself does not use it. If you
327+
do need to add a link option to get `std::filesystem` to work, you'll have to
328+
pass that option yourself.
328329

329330
In the lint script (now called `tools/lint.sh`), set `PQXX_LINT=skip` to skip
330331
lint checks. This can speed up `make check` runs, and enable them to run

cmake/config.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ check_function_exists("poll" PQXX_HAVE_POLL)
1212
# Incorporate feature checks based on C++ feature test mac
1313
include(pqxx_cxx_feature_checks)
1414

15-
# This variable is set by one of the snippets in config-tests.
16-
if(!no_need_fslib)
17-
# TODO: This may work for gcc 8, but some clang versions may need -lc++fs.
18-
link_libraries(stdc++fs)
19-
endif()
2015
set(AC_CONFIG_H_IN "${PROJECT_SOURCE_DIR}/include/pqxx/config.h.in")
2116
set(CM_CONFIG_H_IN "${PROJECT_BINARY_DIR}/include/pqxx/config_cmake.h.in")
2217
set(CM_CONFIG_PUB "${PROJECT_BINARY_DIR}/include/pqxx/config-public-compiler.h")

cmake/pqxx_cxx_feature_checks.cmake

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config-tests/no_need_fslib.cxx

Lines changed: 0 additions & 13 deletions
This file was deleted.

configure

Lines changed: 0 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

include/pqxx/config.h.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,3 @@
103103

104104
/* Version number of package */
105105
#undef VERSION
106-
107-
/* Define if this feature is available. */
108-
#undef no_need_fslib

include/pqxx/zview.hxx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#define PQXX_H_ZVIEW
1313

1414
#include <cassert>
15-
#include <filesystem>
1615
#include <string>
1716
#include <string_view>
1817
#include <type_traits>
@@ -113,15 +112,6 @@ public:
113112
zview(literal, size - 1)
114113
{}
115114

116-
#if !defined(_WIN32)
117-
/// Construct a `zview` from a `std::filesystem::path`.
118-
/** @warn We don't currently support this on Windows, where encoding is a
119-
* somewhat complicated question. Answers on the internet often seem
120-
* contradictory.
121-
*/
122-
zview(std::filesystem::path const &p) : zview(p.c_str()) {}
123-
#endif // _WIN32
124-
125115
/// Either a null pointer, or a zero-terminated text buffer.
126116
[[nodiscard]] constexpr char const *c_str() const & noexcept
127117
{

pqxx_cxx_feature_checks.ac

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,4 @@ AC_COMPILE_IFELSE(
129129
[Define if this feature is available.]),
130130
PQXX_HAVE_ZARGS=no)
131131
AC_MSG_RESULT($PQXX_HAVE_ZARGS)
132-
AC_MSG_CHECKING([no_need_fslib])
133-
no_need_fslib=yes
134-
AC_COMPILE_IFELSE(
135-
[read_test(no_need_fslib.cxx)],
136-
AC_DEFINE(
137-
[no_need_fslib],
138-
1,
139-
[Define if this feature is available.]),
140-
no_need_fslib=no)
141-
AC_MSG_RESULT($no_need_fslib)
142132
# End of config.

test/test_blob.cxx

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include <cstdio>
2-
#include <filesystem>
32

43
#include <pqxx/blob>
54
#include <pqxx/transaction>
@@ -609,25 +608,6 @@ void test_blob_close_leaves_blob_unusable()
609608
}
610609

611610

612-
void test_blob_accepts_std_filesystem_path()
613-
{
614-
#if !defined(_WIN32)
615-
char const temp_file[] = "blob-test-filesystem-path.tmp";
616-
pqxx::bytes const data{std::byte{'4'}, std::byte{'2'}};
617-
618-
pqxx::connection cx;
619-
pqxx::work tx{cx};
620-
pqxx::bytes buf;
621-
622-
TempFile const f{std::data(temp_file), data};
623-
std::filesystem::path const path{temp_file};
624-
auto id{pqxx::blob::from_file(tx, path)};
625-
pqxx::blob::to_buf(tx, id, buf, 10);
626-
PQXX_CHECK_EQUAL(buf, data);
627-
#endif // _WIN32
628-
}
629-
630-
631611
PQXX_REGISTER_TEST(test_blob_is_useless_by_default);
632612
PQXX_REGISTER_TEST(test_blob_create_makes_empty_blob);
633613
PQXX_REGISTER_TEST(test_blob_create_with_oid_requires_oid_be_free);
@@ -655,5 +635,4 @@ PQXX_REGISTER_TEST(test_blob_from_file_with_oid_writes_blob);
655635
PQXX_REGISTER_TEST(test_blob_append_to_buf_appends);
656636
PQXX_REGISTER_TEST(test_blob_to_file_writes_file);
657637
PQXX_REGISTER_TEST(test_blob_close_leaves_blob_unusable);
658-
PQXX_REGISTER_TEST(test_blob_accepts_std_filesystem_path);
659638
} // namespace

0 commit comments

Comments
 (0)