@@ -144,108 +144,4 @@ std::string get_filesystem_error_message(const fs::filesystem_error& e)
144144#endif
145145}
146146
147- #ifdef WIN32
148- #ifdef __GLIBCXX__
149-
150- // reference: https://github.com/gcc-mirror/gcc/blob/gcc-7_3_0-release/libstdc%2B%2B-v3/include/std/fstream#L270
151-
152- static std::string openmodeToStr (std::ios_base::openmode mode)
153- {
154- switch (mode & ~std::ios_base::ate) {
155- case std::ios_base::out:
156- case std::ios_base::out | std::ios_base::trunc:
157- return " w" ;
158- case std::ios_base::out | std::ios_base::app:
159- case std::ios_base::app:
160- return " a" ;
161- case std::ios_base::in:
162- return " r" ;
163- case std::ios_base::in | std::ios_base::out:
164- return " r+" ;
165- case std::ios_base::in | std::ios_base::out | std::ios_base::trunc:
166- return " w+" ;
167- case std::ios_base::in | std::ios_base::out | std::ios_base::app:
168- case std::ios_base::in | std::ios_base::app:
169- return " a+" ;
170- case std::ios_base::out | std::ios_base::binary:
171- case std::ios_base::out | std::ios_base::trunc | std::ios_base::binary:
172- return " wb" ;
173- case std::ios_base::out | std::ios_base::app | std::ios_base::binary:
174- case std::ios_base::app | std::ios_base::binary:
175- return " ab" ;
176- case std::ios_base::in | std::ios_base::binary:
177- return " rb" ;
178- case std::ios_base::in | std::ios_base::out | std::ios_base::binary:
179- return " r+b" ;
180- case std::ios_base::in | std::ios_base::out | std::ios_base::trunc | std::ios_base::binary:
181- return " w+b" ;
182- case std::ios_base::in | std::ios_base::out | std::ios_base::app | std::ios_base::binary:
183- case std::ios_base::in | std::ios_base::app | std::ios_base::binary:
184- return " a+b" ;
185- default :
186- return std::string ();
187- }
188- }
189-
190- void ifstream::open (const fs::path& p, std::ios_base::openmode mode)
191- {
192- close ();
193- mode |= std::ios_base::in;
194- m_file = fsbridge::fopen (p, openmodeToStr (mode).c_str ());
195- if (m_file == nullptr ) {
196- return ;
197- }
198- m_filebuf = __gnu_cxx::stdio_filebuf<char >(m_file, mode);
199- rdbuf (&m_filebuf);
200- if (mode & std::ios_base::ate) {
201- seekg (0 , std::ios_base::end);
202- }
203- }
204-
205- void ifstream::close ()
206- {
207- if (m_file != nullptr ) {
208- m_filebuf.close ();
209- fclose (m_file);
210- }
211- m_file = nullptr ;
212- }
213-
214- void ofstream::open (const fs::path& p, std::ios_base::openmode mode)
215- {
216- close ();
217- mode |= std::ios_base::out;
218- m_file = fsbridge::fopen (p, openmodeToStr (mode).c_str ());
219- if (m_file == nullptr ) {
220- return ;
221- }
222- m_filebuf = __gnu_cxx::stdio_filebuf<char >(m_file, mode);
223- rdbuf (&m_filebuf);
224- if (mode & std::ios_base::ate) {
225- seekp (0 , std::ios_base::end);
226- }
227- }
228-
229- void ofstream::close ()
230- {
231- if (m_file != nullptr ) {
232- m_filebuf.close ();
233- fclose (m_file);
234- }
235- m_file = nullptr ;
236- }
237- #else // __GLIBCXX__
238-
239- static_assert (sizeof (*fs::path ().BOOST_FILESYSTEM_C_STR) == sizeof(wchar_t ),
240- "Warning: This build is using boost::filesystem ofstream and ifstream "
241- "implementations which will fail to open paths containing multibyte "
242- "characters. You should delete this static_assert to ignore this warning, "
243- "or switch to a different C++ standard library like the Microsoft C++ "
244- "Standard Library (where boost uses non-standard extensions to construct "
245- " stream objects with wide filenames), or the GNU libstdc++ library (where "
246- " a more complicated workaround has been implemented above).");
247-
248- #endif // __GLIBCXX__
249- #endif // WIN32
250-
251147} // fsbridge
0 commit comments