|
38 | 38 | #endif
|
39 | 39 | #include <cerrno>
|
40 | 40 |
|
41 |
| -#if defined(__wasm) && (defined(EMSCRIPTEN_STANDALONE_WASM) || !defined(__EMSCRIPTEN__)) |
42 |
| -#define BOOST_STANDALONE_WASM 1 |
| 41 | +// Use WASI when not building with emscripten or when BOOST_FILESYSTEM_DISABLE_EMSCRIPTEN_WASI is set |
| 42 | +#if defined(__wasm) && (!defined(__EMSCRIPTEN__) || !defined(BOOST_FILESYSTEM_DISABLE_EMSCRIPTEN_WASI)) |
| 43 | +#define BOOST_FILESYSTEM_STANDALONE_WASM |
43 | 44 | #endif
|
44 | 45 |
|
45 | 46 | #ifdef BOOST_POSIX_API
|
46 | 47 |
|
47 | 48 | #include <sys/types.h>
|
48 | 49 | #include <sys/stat.h>
|
49 | 50 |
|
50 |
| -#if defined(BOOST_STANDALONE_WASM) |
| 51 | +#if defined(BOOST_FILESYSTEM_STANDALONE_WASM) |
51 | 52 | // WASI does not have statfs or statvfs.
|
52 | 53 | #elif !defined(__APPLE__) && \
|
53 | 54 | (!defined(__OpenBSD__) || BOOST_OS_BSD_OPEN >= BOOST_VERSION_NUMBER(4, 4, 0)) && \
|
@@ -2224,7 +2225,7 @@ bool copy_file(path const& from, path const& to, unsigned int options, error_cod
|
2224 | 2225 | }
|
2225 | 2226 |
|
2226 | 2227 | mode_t to_mode = from_mode;
|
2227 |
| -#if !defined(BOOST_STANDALONE_WASM) |
| 2228 | +#if !defined(BOOST_FILESYSTEM_STANDALONE_WASM) |
2228 | 2229 | // Enable writing for the newly created files. Having write permission set is important e.g. for NFS,
|
2229 | 2230 | // which checks the file permission on the server, even if the client's file descriptor supports writing.
|
2230 | 2231 | to_mode |= S_IWUSR;
|
@@ -2343,7 +2344,7 @@ bool copy_file(path const& from, path const& to, unsigned int options, error_cod
|
2343 | 2344 | if (BOOST_UNLIKELY(err != 0))
|
2344 | 2345 | goto fail; // err already contains the error code
|
2345 | 2346 |
|
2346 |
| -#if !defined(BOOST_STANDALONE_WASM) |
| 2347 | +#if !defined(BOOST_FILESYSTEM_STANDALONE_WASM) |
2347 | 2348 | // If we created a new file with an explicitly added S_IWUSR permission,
|
2348 | 2349 | // we may need to update its mode bits to match the source file.
|
2349 | 2350 | if (to_mode != from_mode)
|
@@ -2779,7 +2780,7 @@ void create_symlink(path const& to, path const& from, error_code* ec)
|
2779 | 2780 | BOOST_FILESYSTEM_DECL
|
2780 | 2781 | path current_path(error_code* ec)
|
2781 | 2782 | {
|
2782 |
| -#if defined(UNDER_CE) || defined(BOOST_STANDALONE_WASM) |
| 2783 | +#if defined(UNDER_CE) || defined(BOOST_FILESYSTEM_STANDALONE_WASM) |
2783 | 2784 | // Windows CE has no current directory, so everything's relative to the root of the directory tree.
|
2784 | 2785 | // WASI also does not support current path.
|
2785 | 2786 | emit_error(BOOST_ERROR_NOT_SUPPORTED, ec, "boost::filesystem::current_path");
|
@@ -2849,7 +2850,7 @@ path current_path(error_code* ec)
|
2849 | 2850 | BOOST_FILESYSTEM_DECL
|
2850 | 2851 | void current_path(path const& p, system::error_code* ec)
|
2851 | 2852 | {
|
2852 |
| -#if defined(UNDER_CE) || defined(BOOST_STANDALONE_WASM) |
| 2853 | +#if defined(UNDER_CE) || defined(BOOST_FILESYSTEM_STANDALONE_WASM) |
2853 | 2854 | emit_error(BOOST_ERROR_NOT_SUPPORTED, p, ec, "boost::filesystem::current_path");
|
2854 | 2855 | #else
|
2855 | 2856 | error(!BOOST_SET_CURRENT_DIRECTORY(p.c_str()) ? BOOST_ERRNO : 0, p, ec, "boost::filesystem::current_path");
|
@@ -3353,7 +3354,7 @@ void permissions(path const& p, perms prms, system::error_code* ec)
|
3353 | 3354 | if ((prms & add_perms) && (prms & remove_perms)) // precondition failed
|
3354 | 3355 | return;
|
3355 | 3356 |
|
3356 |
| -#if defined(BOOST_STANDALONE_WASM) |
| 3357 | +#if defined(BOOST_FILESYSTEM_STANDALONE_WASM) |
3357 | 3358 | emit_error(BOOST_ERROR_NOT_SUPPORTED, p, ec, "boost::filesystem::permissions");
|
3358 | 3359 | #elif defined(BOOST_POSIX_API)
|
3359 | 3360 | error_code local_ec;
|
@@ -3617,7 +3618,7 @@ space_info space(path const& p, error_code* ec)
|
3617 | 3618 | if (ec)
|
3618 | 3619 | ec->clear();
|
3619 | 3620 |
|
3620 |
| -#if defined(BOOST_STANDALONE_WASM) |
| 3621 | +#if defined(BOOST_FILESYSTEM_STANDALONE_WASM) |
3621 | 3622 |
|
3622 | 3623 | emit_error(BOOST_ERROR_NOT_SUPPORTED, p, ec, "boost::filesystem::space");
|
3623 | 3624 |
|
|
0 commit comments