64
64
#define GHC_OS_SYS5R4
65
65
#elif defined(BSD)
66
66
#define GHC_OS_BSD
67
+ #elif defined(__EMSCRIPTEN__)
68
+ #define GHC_OS_WEB
69
+ #include < wasi/api.h>
67
70
#else
68
71
#error "Operating system currently not supported!"
69
72
#endif
@@ -590,7 +593,9 @@ enum class copy_options : uint16_t {
590
593
591
594
directories_only = 0x40 ,
592
595
create_symlinks = 0x80 ,
596
+ #ifndef GHC_OS_WEB
593
597
create_hard_links = 0x100
598
+ #endif
594
599
};
595
600
596
601
enum class directory_options : uint16_t {
@@ -701,10 +706,14 @@ class GHC_FS_API_CLASS directory_entry
701
706
uintmax_t file_size () const ;
702
707
#endif
703
708
uintmax_t file_size (std::error_code& ec) const noexcept ;
709
+
710
+ #ifndef GHC_OS_WEB
704
711
#ifdef GHC_WITH_EXCEPTIONS
705
712
uintmax_t hard_link_count () const ;
706
713
#endif
707
714
uintmax_t hard_link_count (std::error_code& ec) const noexcept ;
715
+ #endif
716
+
708
717
#ifdef GHC_WITH_EXCEPTIONS
709
718
file_time_type last_write_time () const ;
710
719
#endif
@@ -934,10 +943,12 @@ GHC_FS_API void create_directory_symlink(const path& to, const path& new_symlink
934
943
#endif
935
944
GHC_FS_API void create_directory_symlink (const path& to, const path& new_symlink, std::error_code& ec) noexcept ;
936
945
946
+ #ifndef GHC_OS_WEB
937
947
#ifdef GHC_WITH_EXCEPTIONS
938
948
GHC_FS_API void create_hard_link (const path& to, const path& new_hard_link);
939
949
#endif
940
950
GHC_FS_API void create_hard_link (const path& to, const path& new_hard_link, std::error_code& ec) noexcept ;
951
+ #endif
941
952
942
953
#ifdef GHC_WITH_EXCEPTIONS
943
954
GHC_FS_API void create_symlink (const path& to, const path& new_symlink);
@@ -969,10 +980,12 @@ GHC_FS_API uintmax_t file_size(const path& p);
969
980
#endif
970
981
GHC_FS_API uintmax_t file_size (const path& p, std::error_code& ec) noexcept ;
971
982
983
+ #ifndef GHC_OS_WEB
972
984
#ifdef GHC_WITH_EXCEPTIONS
973
985
GHC_FS_API uintmax_t hard_link_count (const path& p);
974
986
#endif
975
987
GHC_FS_API uintmax_t hard_link_count (const path& p, std::error_code& ec) noexcept ;
988
+ #endif
976
989
977
990
GHC_FS_API bool is_block_file (file_status s) noexcept ;
978
991
#ifdef GHC_WITH_EXCEPTIONS
@@ -1815,13 +1828,15 @@ GHC_INLINE void create_symlink(const path& target_name, const path& new_symlink,
1815
1828
}
1816
1829
}
1817
1830
1831
+ #ifndef GHC_OS_WEB
1818
1832
GHC_INLINE void create_hardlink (const path& target_name, const path& new_hardlink, std::error_code& ec)
1819
1833
{
1820
1834
if (::link (target_name.c_str (), new_hardlink.c_str ()) != 0 ) {
1821
1835
ec = detail::make_system_error ();
1822
1836
}
1823
1837
}
1824
1838
#endif
1839
+ #endif
1825
1840
1826
1841
template <typename T>
1827
1842
GHC_INLINE file_status file_status_from_st_mode (T mode)
@@ -3402,9 +3417,11 @@ GHC_INLINE void copy(const path& from, const path& to, copy_options options, std
3402
3417
if ((options & copy_options::create_symlinks) != copy_options::none) {
3403
3418
create_symlink (from.is_absolute () ? from : canonical (from, ec), to, ec);
3404
3419
}
3420
+ #ifndef GHC_OS_WEB
3405
3421
else if ((options & copy_options::create_hard_links) != copy_options::none) {
3406
3422
create_hard_link (from, to, ec);
3407
3423
}
3424
+ #endif
3408
3425
else if (is_directory (fs_to)) {
3409
3426
copy_file (from, to / from.filename (), options, ec);
3410
3427
}
@@ -3697,6 +3714,7 @@ GHC_INLINE void create_directory_symlink(const path& to, const path& new_symlink
3697
3714
detail::create_symlink (to, new_symlink, true , ec);
3698
3715
}
3699
3716
3717
+ #ifndef GHC_OS_WEB
3700
3718
#ifdef GHC_WITH_EXCEPTIONS
3701
3719
GHC_INLINE void create_hard_link (const path& to, const path& new_hard_link)
3702
3720
{
@@ -3712,6 +3730,7 @@ GHC_INLINE void create_hard_link(const path& to, const path& new_hard_link, std:
3712
3730
{
3713
3731
detail::create_hardlink (to, new_hard_link, ec);
3714
3732
}
3733
+ #endif
3715
3734
3716
3735
#ifdef GHC_WITH_EXCEPTIONS
3717
3736
GHC_INLINE void create_symlink (const path& to, const path& new_symlink)
@@ -3900,6 +3919,7 @@ GHC_INLINE uintmax_t file_size(const path& p, std::error_code& ec) noexcept
3900
3919
#endif
3901
3920
}
3902
3921
3922
+ #ifndef GHC_OS_WEB
3903
3923
#ifdef GHC_WITH_EXCEPTIONS
3904
3924
GHC_INLINE uintmax_t hard_link_count (const path& p)
3905
3925
{
@@ -3940,6 +3960,7 @@ GHC_INLINE uintmax_t hard_link_count(const path& p, std::error_code& ec) noexcep
3940
3960
return ec ? static_cast <uintmax_t >(-1 ) : result;
3941
3961
#endif
3942
3962
}
3963
+ #endif
3943
3964
3944
3965
GHC_INLINE bool is_block_file (file_status s) noexcept
3945
3966
{
@@ -4176,7 +4197,7 @@ GHC_INLINE void last_write_time(const path& p, file_time_type new_time, std::err
4176
4197
times[0 ].tv_sec = 0 ;
4177
4198
times[0 ].tv_nsec = UTIME_OMIT;
4178
4199
times[1 ].tv_sec = std::chrono::duration_cast<std::chrono::seconds>(d).count ();
4179
- times[1 ].tv_nsec = std::chrono::duration_cast<std::chrono::nanoseconds>(d).count () % 1000000000 ;
4200
+ times[1 ].tv_nsec = 0 ; // std::chrono::duration_cast<std::chrono::nanoseconds>(d).count() % 1000000000;
4180
4201
if (::utimensat (AT_FDCWD, p.c_str (), times, AT_SYMLINK_NOFOLLOW) != 0 ) {
4181
4202
ec = detail::make_system_error ();
4182
4203
}
@@ -4945,6 +4966,7 @@ GHC_INLINE uintmax_t directory_entry::file_size(std::error_code& ec) const noexc
4945
4966
return filesystem::file_size (path (), ec);
4946
4967
}
4947
4968
4969
+ #ifndef GHC_OS_WEB
4948
4970
#ifdef GHC_WITH_EXCEPTIONS
4949
4971
GHC_INLINE uintmax_t directory_entry::hard_link_count () const
4950
4972
{
@@ -4967,6 +4989,7 @@ GHC_INLINE uintmax_t directory_entry::hard_link_count(std::error_code& ec) const
4967
4989
#endif
4968
4990
return filesystem::hard_link_count (path (), ec);
4969
4991
}
4992
+ #endif
4970
4993
4971
4994
#ifdef GHC_WITH_EXCEPTIONS
4972
4995
GHC_INLINE file_time_type directory_entry::last_write_time () const
0 commit comments