HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
filesystem.h
Go to the documentation of this file.
1 /*
2  Copyright 2008 Larry Gritz and the other authors and contributors.
3  All Rights Reserved.
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions are
7  met:
8  * Redistributions of source code must retain the above copyright
9  notice, this list of conditions and the following disclaimer.
10  * Redistributions in binary form must reproduce the above copyright
11  notice, this list of conditions and the following disclaimer in the
12  documentation and/or other materials provided with the distribution.
13  * Neither the name of the software's owners nor the names of its
14  contributors may be used to endorse or promote products derived from
15  this software without specific prior written permission.
16  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28  (This is the Modified BSD License)
29 */
30 
31 // clang-format off
32 
33 /// @file filesystem.h
34 ///
35 /// @brief Utilities for dealing with file names and files portably.
36 ///
37 /// Some helpful nomenclature:
38 /// - "filename" - a file or directory name, relative or absolute
39 /// - "searchpath" - a list of directories separated by ':' or ';'.
40 ///
41 
42 
43 #pragma once
44 
45 #include <cstdint>
46 #include <cstdio>
47 #include <ctime>
48 #include <fstream>
49 #include <mutex>
50 #include <string>
51 #include <vector>
52 
53 #include <OpenImageIO/span.h>
54 #include <OpenImageIO/export.h>
57 
58 #if defined(_WIN32) && defined(__GLIBCXX__)
59 # define OIIO_FILESYSTEM_USE_STDIO_FILEBUF 1
61 #endif
62 
63 
64 // Define symbols that let client applications determine if newly added
65 // features are supported.
66 #define OIIO_FILESYSTEM_SUPPORTS_IOPROXY 1
67 
68 
69 
71 
72 #if OIIO_FILESYSTEM_USE_STDIO_FILEBUF
73 // MingW uses GCC to build, but does not support having a wchar_t* passed as argument
74 // of ifstream::open or ofstream::open. To properly support UTF-8 encoding on MingW we must
75 // use the __gnu_cxx::stdio_filebuf GNU extension that can be used with _wfsopen and returned
76 // into a istream which share the same API as ifsteam. The same reasoning holds for ofstream.
77 typedef basic_ifstream<char> ifstream;
78 typedef basic_ofstream<char> ofstream;
79 #else
82 #endif
83 
84 /// @namespace Filesystem
85 ///
86 /// @brief Platform-independent utilities for manipulating file names,
87 /// files, directories, and other file system miscellany.
88 
89 namespace Filesystem {
90 
91 /// Return the filename (excluding any directories, but including the
92 /// file extension, if any) of a filepath.
93 OIIO_API std::string filename (const std::string &filepath);
94 
95 /// Return the file extension (including the last '.' if
96 /// include_dot=true) of a filename or filepath.
97 OIIO_API std::string extension (const std::string &filepath,
98  bool include_dot=true);
99 
100 /// Return all but the last part of the path, for example,
101 /// parent_path("foo/bar") returns "foo", and parent_path("foo")
102 /// returns "".
103 OIIO_API std::string parent_path (const std::string &filepath);
104 
105 /// Replace the file extension of a filename or filepath. Does not alter
106 /// filepath, just returns a new string. Note that the new_extension
107 /// should contain a leading '.' dot.
109  const std::string &new_extension);
110 
111 /// Turn a searchpath (multiple directory paths separated by ':' or ';')
112 /// into a vector<string> containing each individual directory. If
113 /// validonly is true, only existing and readable directories will end
114 /// up in the list. N.B., the directory names will not have trailing
115 /// slashes.
116 OIIO_API void searchpath_split (const std::string &searchpath,
117  std::vector<std::string> &dirs,
118  bool validonly = false);
119 
120 /// Find the first instance of a filename existing in a vector of
121 /// directories, returning the full path as a string. If the file is
122 /// not found in any of the listed directories, return an empty string.
123 /// If the filename is absolute, the directory list will not be used.
124 /// If testcwd is true, "." will be tested before the searchpath;
125 /// otherwise, "." will only be tested if it's explicitly in dirs. If
126 /// recursive is true, the directories will be searched recursively,
127 /// finding a matching file in any subdirectory of the directories
128 /// listed in dirs; otherwise.
130  const std::vector<std::string> &dirs,
131  bool testcwd = true,
132  bool recursive = false);
133 
134 /// Fill a vector-of-strings with the names of all files contained by
135 /// directory dirname. If recursive is true, it will return all files
136 /// below the directory (even in subdirectories), but if recursive is
137 /// false (the default)If filter_regex is supplied and non-empty, only
138 /// filenames matching the regular expression will be returned. Return
139 /// true if ok, false if there was an error (such as dirname not being
140 /// found or not actually being a directory).
141 OIIO_API bool get_directory_entries (const std::string &dirname,
142  std::vector<std::string> &filenames,
143  bool recursive = false,
144  const std::string &filter_regex=std::string());
145 
146 /// Return true if the path is an "absolute" (not relative) path.
147 /// If 'dot_is_absolute' is true, consider "./foo" absolute.
149  bool dot_is_absolute=false);
150 
151 /// Return true if the file exists.
152 ///
153 OIIO_API bool exists (const std::string &path);
154 
155 
156 /// Return true if the file exists and is a directory.
157 ///
158 OIIO_API bool is_directory (const std::string &path);
159 
160 /// Return true if the file exists and is a regular file.
161 ///
162 OIIO_API bool is_regular (const std::string &path);
163 
164 /// Create the directory. Return true for success, false for failure and
165 /// place an error message in err.
167 inline bool create_directory (string_view path) {
168  std::string err;
169  return create_directory (path, err);
170 }
171 
172 /// Copy a file, directory, or link. It is an error if 'to' already exists.
173 /// Return true upon success, false upon failure and place an error message
174 /// in err.
175 OIIO_API bool copy (string_view from, string_view to, std::string &err);
176 inline bool copy (string_view from, string_view to) {
177  std::string err;
178  return copy (from, to, err);
179 }
180 
181 /// Rename (or move) a file, directory, or link. Return true upon success,
182 /// false upon failure and place an error message in err.
183 OIIO_API bool rename (string_view from, string_view to, std::string &err);
184 inline bool rename (string_view from, string_view to) {
185  std::string err;
186  return rename (from, to, err);
187 }
188 
189 /// Remove the file or directory. Return true for success, false for
190 /// failure and place an error message in err.
191 OIIO_API bool remove (string_view path, std::string &err);
192 inline bool remove (string_view path) {
193  std::string err;
194  return remove (path, err);
195 }
196 
197 /// Remove the file or directory, including any children (recursively).
198 /// Return the number of files removed. Place an error message (if
199 /// applicable in err.
200 OIIO_API unsigned long long remove_all (string_view path, std::string &err);
201 inline unsigned long long remove_all (string_view path) {
202  std::string err;
203  return remove_all (path, err);
204 }
205 
206 /// Return a directory path where temporary files can be made.
207 ///
209 
210 /// Return a unique filename suitable for making a temporary file or
211 /// directory.
212 OIIO_API std::string unique_path (string_view model="%%%%-%%%%-%%%%-%%%%");
213 
214 /// Version of fopen that can handle UTF-8 paths even on Windows
215 ///
217 
218 /// Return the current (".") directory path.
219 ///
221 
222 /// Version of std::ifstream.open that can handle UTF-8 paths
223 ///
225  std::ios_base::openmode mode = std::ios_base::in);
226 
227 /// Version of std::ofstream.open that can handle UTF-8 paths
228 ///
230  std::ios_base::openmode mode = std::ios_base::out);
231 
232 
233 /// Read the entire contents of the named text file and place it in str,
234 /// returning true on success, false on failure.
235 OIIO_API bool read_text_file (string_view filename, std::string &str);
236 
237 /// Read a maximum of n bytes from the named file, starting at position pos
238 /// (which defaults to the start of the file), storing results in
239 /// buffer[0..n-1]. Return the number of bytes read, which will be n for
240 /// full success, less than n if the file was fewer than n+pos bytes long,
241 /// or 0 if the file did not exist or could not be read.
242 OIIO_API size_t read_bytes (string_view path, void *buffer, size_t n,
243  size_t pos=0);
244 
245 /// Get last modified time of file
246 ///
247 OIIO_API std::time_t last_write_time (const std::string& path);
248 
249 /// Set last modified time on file
250 ///
251 OIIO_API void last_write_time (const std::string& path, std::time_t time);
252 
253 /// Return the size of the file (in bytes), or uint64_t(-1) if there is any
254 /// error.
255 OIIO_API uint64_t file_size (string_view path);
256 
257 /// Ensure command line arguments are UTF-8 everywhere
258 ///
259 OIIO_API void convert_native_arguments (int argc, const char *argv[]);
260 
261 /// Turn a sequence description string into a vector of integers.
262 /// The sequence description can be any of the following
263 /// * A value (e.g., "3")
264 /// * A value range ("1-10", "10-1", "1-10x3", "1-10y3"):
265 /// START-FINISH A range, inclusive of start & finish
266 /// START-FINISHxSTEP A range with step size
267 /// START-FINISHySTEP The complement of a stepped range, that is,
268 /// all numbers within the range that would
269 /// NOT have been selected by 'x'.
270 /// Note that START may be > FINISH, or STEP may be negative.
271 /// * Multiple values or ranges, separated by a comma (e.g., "3,4,10-20x2")
272 /// Retrn true upon success, false if the description was too malformed
273 /// to generate a sequence.
275  std::vector<int> &numbers);
276 
277 /// Given a pattern (such as "foo.#.tif" or "bar.1-10#.exr"), return a
278 /// normalized pattern in printf format (such as "foo.%04d.tif") and a
279 /// framespec (such as "1-10").
280 ///
281 /// If framepadding_override is > 0, it overrides any specific padding amount
282 /// in the original pattern.
283 ///
284 /// Return true upon success, false if the description was too malformed
285 /// to generate a sequence.
286 OIIO_API bool parse_pattern (const char *pattern,
287  int framepadding_override,
288  std::string &normalized_pattern,
289  std::string &framespec);
290 
291 
292 /// Given a normalized pattern (such as "foo.%04d.tif") and a list of frame
293 /// numbers, generate a list of filenames.
294 ///
295 /// Return true upon success, false if the description was too malformed
296 /// to generate a sequence.
298  const std::vector<int> &numbers,
299  std::vector<std::string> &filenames);
300 
301 /// Given a normalized pattern (such as "foo_%V.%04d.tif") and a list of frame
302 /// numbers, generate a list of filenames. "views" is list of per-frame
303 /// views, or empty. In each frame filename, "%V" is replaced with the view,
304 /// and "%v" is replaced with the first character of the view.
305 ///
306 /// Return true upon success, false if the description was too malformed
307 /// to generate a sequence.
309  const std::vector<int> &numbers,
310  const std::vector<string_view> &views,
311  std::vector<std::string> &filenames);
312 
313 /// Given a normalized pattern (such as "/path/to/foo.%04d.tif") scan the
314 /// containing directory (/path/to) for matching frame numbers, views and files.
315 /// "%V" in the pattern matches views, while "%v" matches the first character
316 /// of each entry in views.
317 ///
318 /// Return true upon success, false if the directory doesn't exist or the
319 /// pattern can't be parsed.
321  const std::vector<string_view> &views,
322  std::vector<int> &frame_numbers,
323  std::vector<string_view> &frame_views,
324  std::vector<std::string> &filenames);
325 
326 /// Given a normalized pattern (such as "/path/to/foo.%04d.tif") scan the
327 /// containing directory (/path/to) for matching frame numbers and files.
328 ///
329 /// Return true upon success, false if the directory doesn't exist or the
330 /// pattern can't be parsed.
332  std::vector<int> &numbers,
333  std::vector<std::string> &filenames);
334 
335 
336 
337 /// Proxy class for I/O. This provides a simplified interface for file I/O
338 /// that can have custom overrides.
340 public:
341  enum Mode { Closed = 0, Read = 'r', Write = 'w' };
342  IOProxy () {}
344  : m_filename(filename), m_mode(mode) {}
345  virtual ~IOProxy () { }
346  virtual const char* proxytype () const = 0;
347  virtual void close () { }
348  virtual bool opened () const { return mode() != Closed; }
349  virtual int64_t tell () { return m_pos; }
350  virtual bool seek (int64_t offset) { m_pos = offset; return true; }
351  virtual size_t read (void *buf, size_t size) { return 0; }
352  virtual size_t write (const void *buf, size_t size) { return 0; }
353  // pread(), pwrite() are stateless, do not alter the current file
354  // position, and are thread-safe (against each other).
355  virtual size_t pread (void *buf, size_t size, int64_t offset) { return 0; }
356  virtual size_t pwrite (const void *buf, size_t size, int64_t offset) { return 0; }
357  virtual size_t size () const { return 0; }
358  virtual void flush () const { }
359 
360  Mode mode () const { return m_mode; }
361  const std::string& filename () const { return m_filename; }
362  template<class T> size_t read (span<T> buf) {
363  return read (buf.data(), buf.size()*sizeof(T));
364  }
365  template<class T> size_t write (span<T> buf) {
366  return write (buf.data(), buf.size()*sizeof(T));
367  }
368  size_t write (string_view buf) {
369  return write (buf.data(), buf.size());
370  }
371  bool seek (int64_t offset, int origin) {
372  return seek ((origin == SEEK_SET ? offset : 0) +
373  (origin == SEEK_CUR ? offset+tell() : 0) +
374  (origin == SEEK_END ? size() : 0));
375  }
376 
377 #if OIIO_VERSION >= 20101
378  #define OIIO_IOPROXY_HAS_ERROR 1
379  std::string error() const { return m_error; }
380  void error(string_view e) { m_error = e; }
381 #else
382  std::string error() const { return ""; }
383  void error(string_view e) { }
384 #endif
385 
386 protected:
388  int64_t m_pos = 0;
389  Mode m_mode = Closed;
390 #ifdef OIIO_IOPROXY_HAS_ERROR
391  std::string m_error;
392 #endif
393 };
394 
395 
396 /// IOProxy subclass for reading or writing (but not both) that wraps C
397 /// stdio 'FILE'.
398 class OIIO_API IOFile : public IOProxy {
399 public:
400  // Construct from a filename, open, own the FILE*.
401  IOFile(string_view filename, Mode mode);
402  // Construct from an already-open FILE* that is owned by the caller.
403  // Caller is responsible for closing the FILE* after the proxy is gone.
404  IOFile(FILE* file, Mode mode);
405  virtual ~IOFile();
406  virtual const char* proxytype() const { return "file"; }
407  virtual void close();
408  virtual bool seek(int64_t offset);
409  virtual size_t read(void* buf, size_t size);
410  virtual size_t write(const void* buf, size_t size);
411  virtual size_t pread(void* buf, size_t size, int64_t offset);
412  virtual size_t pwrite(const void* buf, size_t size, int64_t offset);
413  virtual size_t size() const;
414  virtual void flush() const;
415 
416  // Access the FILE*
417  FILE* handle() const { return m_file; }
418 
419 protected:
420  FILE* m_file = nullptr;
421  size_t m_size = 0;
422  bool m_auto_close = false;
423  std::mutex m_mutex;
424 };
425 
426 
427 /// IOProxy subclass for writing that wraps a std::vector<char> that will
428 /// grow as we write.
429 class OIIO_API IOVecOutput : public IOProxy {
430 public:
431  // Construct, IOVecOutput owns its own vector.
433  : IOProxy("", IOProxy::Write)
434  , m_buf(m_local_buf)
435  {
436  }
437  // Construct to wrap an existing vector.
438  IOVecOutput(std::vector<unsigned char>& buf)
439  : IOProxy("", Write)
440  , m_buf(buf)
441  {
442  }
443  virtual const char* proxytype() const { return "vecoutput"; }
444  virtual size_t write(const void* buf, size_t size);
445  virtual size_t pwrite(const void* buf, size_t size, int64_t offset);
446  virtual size_t size() const { return m_buf.size(); }
447 
448  // Access the buffer
449  std::vector<unsigned char>& buffer() const { return m_buf; }
450 
451 protected:
452  std::vector<unsigned char>& m_buf; // reference to buffer
453  std::vector<unsigned char> m_local_buf; // our own buffer
454  std::mutex m_mutex; // protect the buffer
455 };
456 
457 
458 
459 /// IOProxy subclass for reading that wraps an cspan<char>.
460 class OIIO_API IOMemReader : public IOProxy {
461 public:
462  IOMemReader(void* buf, size_t size)
463  : IOProxy("", Read)
464  , m_buf((const unsigned char*)buf, size)
465  {
466  }
468  : IOProxy("", Read)
469  , m_buf(buf.data(), buf.size())
470  {
471  }
472  virtual const char* proxytype() const { return "memreader"; }
473  virtual bool seek(int64_t offset)
474  {
475  m_pos = offset;
476  return true;
477  }
478  virtual size_t read(void* buf, size_t size);
479  virtual size_t pread(void* buf, size_t size, int64_t offset);
480  virtual size_t size() const { return m_buf.size(); }
481 
482  // Access the buffer (caveat emptor)
483  cspan<unsigned char> buffer() const noexcept { return m_buf; }
484 
485 protected:
487 };
488 
489 }; // namespace Filesystem
490 
OIIO_API std::string filename(const std::string &filepath)
OIIO_API bool is_regular(const std::string &path)
GLsizeiptr size
Definition: glew.h:1681
GLuint GLuint stream
Definition: glew.h:7265
OIIO_API bool path_is_absolute(const std::string &path, bool dot_is_absolute=false)
OIIO_API size_t read_bytes(string_view path, void *buffer, size_t n, size_t pos=0)
constexpr index_type size() const noexcept
Definition: span.h:148
OIIO_NAMESPACE_BEGIN typedef std::ifstream ifstream
Definition: filesystem.h:80
#define SEEK_CUR
Definition: zconf.h:471
GLenum mode
Definition: glew.h:2163
GT_API const UT_StringHolder time
std::ofstream ofstream
Definition: filesystem.h:81
OIIO_API bool rename(string_view from, string_view to, std::string &err)
OIIO_API bool exists(const std::string &path)
OIIO_API bool enumerate_file_sequence(const std::string &pattern, const std::vector< int > &numbers, std::vector< std::string > &filenames)
IOProxy(string_view filename, Mode mode)
Definition: filesystem.h:343
Definition: span.h:47
#define SEEK_END
Definition: zconf.h:472
virtual void flush() const
Definition: filesystem.h:358
void error(string_view e)
Definition: filesystem.h:383
OIIO_API FILE * fopen(string_view path, string_view mode)
OIIO_API bool get_directory_entries(const std::string &dirname, std::vector< std::string > &filenames, bool recursive=false, const std::string &filter_regex=std::string())
virtual const char * proxytype() const
Definition: filesystem.h:472
OIIO_API bool read_text_file(string_view filename, std::string &str)
virtual size_t read(void *buf, size_t size)
Definition: filesystem.h:351
void close() override
OIIO_API std::string searchpath_find(const std::string &filename, const std::vector< std::string > &dirs, bool testcwd=true, bool recursive=false)
void read(T &in, bool &v)
Definition: ImfXdr.h:611
OIIO_API std::string parent_path(const std::string &filepath)
virtual const char * proxytype() const
Definition: filesystem.h:406
IOMemReader(void *buf, size_t size)
Definition: filesystem.h:462
const charT * data() const
Definition: string_view.h:176
std::string m_filename
Definition: filesystem.h:387
size_t read(span< T > buf)
Definition: filesystem.h:362
OIIO_API std::string extension(const std::string &filepath, bool include_dot=true)
OIIO_API bool parse_pattern(const char *pattern, int framepadding_override, std::string &normalized_pattern, std::string &framespec)
size_type size() const
Definition: string_view.h:161
GLuint in
Definition: glew.h:11510
GLuint buffer
Definition: glew.h:1680
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
OIIO_API uint64_t file_size(string_view path)
virtual bool seek(int64_t offset)
Definition: filesystem.h:350
virtual size_t size() const
Definition: filesystem.h:357
FILE * handle() const
Definition: filesystem.h:417
virtual size_t write(const void *buf, size_t size)
Definition: filesystem.h:352
OIIO_API std::time_t last_write_time(const std::string &path)
GLsizei n
Definition: glew.h:4040
virtual size_t pwrite(const void *buf, size_t size, int64_t offset)
Definition: filesystem.h:356
virtual const char * proxytype() const
Definition: filesystem.h:443
size_t write(string_view buf)
Definition: filesystem.h:368
std::string error() const
Definition: filesystem.h:382
const std::string & filename() const
Definition: filesystem.h:361
virtual ~IOProxy()
Definition: filesystem.h:345
virtual int64_t tell()
Definition: filesystem.h:349
OIIO_API bool scan_for_matching_filenames(const std::string &pattern, const std::vector< string_view > &views, std::vector< int > &frame_numbers, std::vector< string_view > &frame_views, std::vector< std::string > &filenames)
bool seek(int64_t offset, int origin)
Definition: filesystem.h:371
virtual size_t size() const
Definition: filesystem.h:446
GLsizei const GLchar *const * path
Definition: glew.h:6461
virtual size_t pread(void *buf, size_t size, int64_t offset)
Definition: filesystem.h:355
IOProxy subclass for reading that wraps an cspan<char>.
Definition: filesystem.h:460
#define SEEK_SET
Definition: zconf.h:470
GLsizei const GLchar *const * string
Definition: glew.h:1844
OIIO_API bool enumerate_sequence(string_view desc, std::vector< int > &numbers)
virtual size_t size() const
Definition: filesystem.h:480
Mode mode() const
Definition: filesystem.h:360
Utilities for dealing with fstream on MingW. Basically accepting wchar_t* filenames in the std::ifstr...
std::mutex m_mutex
Definition: filesystem.h:423
OIIO_API void searchpath_split(const std::string &searchpath, std::vector< std::string > &dirs, bool validonly=false)
virtual bool opened() const
Definition: filesystem.h:348
IOMemReader(cspan< unsigned char > buf)
Definition: filesystem.h:467
std::vector< unsigned char > & m_buf
Definition: filesystem.h:452
OIIO_API bool copy(string_view from, string_view to, std::string &err)
virtual bool seek(int64_t offset)
Definition: filesystem.h:473
OIIO_API bool is_directory(const std::string &path)
size_t write(span< T > buf)
Definition: filesystem.h:365
OIIO_API void convert_native_arguments(int argc, const char *argv[])
OIIO_API bool create_directory(string_view path, std::string &err)
OIIO_API std::string unique_path(string_view model="%%%%-%%%%-%%%%-%%%%")
OIIO_API std::string current_path()
#define const
Definition: zconf.h:214
#define OIIO_NAMESPACE_END
Definition: oiioversion.h:66
GLubyte * pattern
Definition: glew.h:5711
void write(T &out, bool v)
Definition: ImfXdr.h:332
GLenum GLuint GLsizei const GLchar * buf
Definition: glew.h:2580
virtual void close()
Definition: filesystem.h:347
cspan< unsigned char > m_buf
Definition: filesystem.h:486
std::vector< unsigned char > & buffer() const
Definition: filesystem.h:449
constexpr pointer data() const noexcept
Definition: span.h:152
cspan< unsigned char > buffer() const noexcept
Definition: filesystem.h:483
OIIO_API unsigned long long remove_all(string_view path, std::string &err)
OIIO_API std::string replace_extension(const std::string &filepath, const std::string &new_extension)
std::vector< unsigned char > m_local_buf
Definition: filesystem.h:453
OIIO_API void open(OIIO::ifstream &stream, string_view path, std::ios_base::openmode mode=std::ios_base::in)
#define OIIO_NAMESPACE_BEGIN
Definition: oiioversion.h:65
IOVecOutput(std::vector< unsigned char > &buf)
Definition: filesystem.h:438
#define OIIO_API
Definition: export.h:91
GLintptr offset
Definition: glew.h:1682
OIIO_API std::string temp_directory_path()