This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
ofFileUtils.h
Go to the documentation of this file.
284bool ofBufferToFile(const of::filesystem::path & path, const ofBuffer& buffer, bool binary=true);
347 // static of::filesystem::path getAbsolutePath(const of::filesystem::path& path, bool bRelativeToData = true);
348 static std::string getAbsolutePath(const of::filesystem::path& path, bool bRelativeToData = true);
369 static std::string getFileName(const of::filesystem::path& filePath, bool bRelativeToData = true);
389// static of::filesystem::path getEnclosingDirectory(const of::filesystem::path& filePath, bool bRelativeToData = true);
390 static std::string getEnclosingDirectory(const of::filesystem::path& filePath, bool bRelativeToData = true);
404 static bool createEnclosingDirectory(const of::filesystem::path& filePath, bool bRelativeToData = true, bool bRecursive = true);
423// static of::filesystem::path join(const of::filesystem::path& path1, const of::filesystem::path& path2);
462// static of::filesystem::path makeRelative(const of::filesystem::path & from, const of::filesystem::path & to);
463 static std::string makeRelative(const of::filesystem::path & from, const of::filesystem::path & to);
483 };
686 bool copyTo(const of::filesystem::path& path, bool bRelativeToData = true, bool overwrite = false) const;
700 bool moveTo(const of::filesystem::path& path, bool bRelativeToData = true, bool overwrite = false);
714 bool renameTo(const of::filesystem::path& path, bool bRelativeToData = true, bool overwrite = false);
792 static bool copyFromTo(const of::filesystem::path& pathSrc, const of::filesystem::path& pathDst, bool bRelativeToData = true, bool overwrite = false);
808 static bool moveFromTo(const of::filesystem::path& pathSrc, const of::filesystem::path& pathDst, bool bRelativeToData = true, bool overwrite = false);
961 bool copyTo(const of::filesystem::path& path, bool bRelativeToData = true, bool overwrite = false);
975 bool moveTo(const of::filesystem::path& path, bool bRelativeToData = true, bool overwrite = false);
989 bool renameTo(const of::filesystem::path& path, bool bRelativeToData = true, bool overwrite = false);
1071 ofFile getFile(std::size_t position, ofFile::Mode mode=ofFile::Reference, bool binary=true) const;
1168 static bool createDirectory(const of::filesystem::path& dirPath, bool bRelativeToData = true, bool recursive = false);
1179 static bool isDirectoryEmpty(const of::filesystem::path& dirPath, bool bRelativeToData = true );
1189 static bool doesDirectoryExist(const of::filesystem::path& dirPath, bool bRelativeToData = true);
1199 static bool removeDirectory(const of::filesystem::path& path, bool deleteIfNotEmpty, bool bRelativeToData = true);
Definition ofFileUtils.h:15
OF_DEPRECATED_MSG("use a lines iterator instead", std::string getNextLine())
OF_DEPRECATED_MSG("use a lines iterator instead", std::string getFirstLine())
bool set(std::istream &stream, std::size_t ioBlockSize=1024)
bool writeTo(std::ostream &stream) const
Write contents of the buffer to an output stream.
Definition ofFileUtils.cpp:116
friend std::ostream & operator<<(std::ostream &ostr, const ofBuffer &buf)
void clear()
Remove all bytes from the buffer, leaving a size of 0.
Definition ofFileUtils.cpp:150
ofBuffer(std::istream &stream, std::size_t ioBlockSize=1024)
friend std::istream & operator>>(std::istream &istr, ofBuffer &buf)
ofBuffer & operator=(const std::string &text)
set contents of the buffer from a string
Definition ofFileUtils.cpp:199
OF_DEPRECATED_MSG("Use getData instead", const char *getBinaryBuffer() const)
OF_DEPRECATED_MSG("use a lines iterator instead", void resetLineReader())
OF_DEPRECATED_MSG("use a lines iterator instead", bool isLastLine())
OF_DEPRECATED_MSG("Use getData instead", char *getBinaryBuffer())
Definition ofFileUtils.h:842
static bool isDirectoryEmpty(const of::filesystem::path &dirPath, bool bRelativeToData=true)
Definition ofFileUtils.cpp:1655
ofFile getFile(std::size_t position, ofFile::Mode mode=ofFile::Reference, bool binary=true) const
Definition ofFileUtils.cpp:1451
bool copyTo(const of::filesystem::path &path, bool bRelativeToData=true, bool overwrite=false)
Definition ofFileUtils.cpp:1288
OF_DEPRECATED_MSG("Use ofDirectory::setWriteable(!flag).", void setReadOnly(bool flag))
std::vector< ofFile >::const_iterator begin() const
Definition ofFileUtils.cpp:1698
std::string getOriginalDirectory() const
Definition ofFileUtils.cpp:1436
static bool createDirectory(const of::filesystem::path &dirPath, bool bRelativeToData=true, bool recursive=false)
Definition ofFileUtils.cpp:1606
static bool doesDirectoryExist(const of::filesystem::path &dirPath, bool bRelativeToData=true)
Definition ofFileUtils.cpp:1640
static bool removeDirectory(const of::filesystem::path &path, bool deleteIfNotEmpty, bool bRelativeToData=true)
Definition ofFileUtils.cpp:1592
bool renameTo(const of::filesystem::path &path, bool bRelativeToData=true, bool overwrite=false)
Definition ofFileUtils.cpp:1352
bool moveTo(const of::filesystem::path &path, bool bRelativeToData=true, bool overwrite=false)
Definition ofFileUtils.cpp:1343
OF_DEPRECATED_MSG("Use size() instead.", int numFiles())
std::vector< ofFile >::const_reverse_iterator rend() const
Definition ofFileUtils.cpp:1713
std::vector< ofFile >::const_reverse_iterator rbegin() const
Definition ofFileUtils.cpp:1708
void openFromCWD(const of::filesystem::path &path)
Definition ofFileUtils.cpp:1175
Definition ofFileUtils.h:472
void setReadable(bool readable=true)
Set the readable flag of the current path.
Definition ofFileUtils.cpp:856
bool open(const of::filesystem::path &path, Mode mode=ReadOnly, bool binary=true)
Definition ofFileUtils.cpp:559
static bool removeFile(const of::filesystem::path &path, bool bRelativeToData=true)
Definition ofFileUtils.cpp:1139
bool copyTo(const of::filesystem::path &path, bool bRelativeToData=true, bool overwrite=false) const
Definition ofFileUtils.cpp:914
bool moveTo(const of::filesystem::path &path, bool bRelativeToData=true, bool overwrite=false)
Definition ofFileUtils.cpp:971
void setWriteable(bool writeable=true)
Set the writable flag of the current path.
Definition ofFileUtils.cpp:825
void setExecutable(bool executable=true)
Set the executable flag of the current path.
Definition ofFileUtils.cpp:881
static bool doesFileExist(const of::filesystem::path &fPath, bool bRelativeToData=true)
Definition ofFileUtils.cpp:1128
OF_DEPRECATED_MSG("Use ofFile::setWriteable(!flag).", void setReadOnly(bool flag))
bool openFromCWD(const of::filesystem::path &path, Mode mode=ReadOnly, bool binary=true)
Definition ofFileUtils.cpp:566
std::string getEnclosingDirectory() const
Definition ofFileUtils.cpp:682
bool renameTo(const of::filesystem::path &path, bool bRelativeToData=true, bool overwrite=false)
Definition ofFileUtils.cpp:1029
static bool copyFromTo(const of::filesystem::path &pathSrc, const of::filesystem::path &pathDst, bool bRelativeToData=true, bool overwrite=false)
Definition ofFileUtils.cpp:1105
static bool moveFromTo(const of::filesystem::path &pathSrc, const of::filesystem::path &pathDst, bool bRelativeToData=true, bool overwrite=false)
Definition ofFileUtils.cpp:1117
Definition ofFileUtils.h:291
static std::string removeExt(const of::filesystem::path &filename)
Definition ofFileUtils.cpp:1769
static std::string removeTrailingSlash(const of::filesystem::path &path)
Definition ofFileUtils.cpp:1799
static std::string getEnclosingDirectory(const of::filesystem::path &filePath, bool bRelativeToData=true)
Definition ofFileUtils.cpp:1830
static std::string getAbsolutePath(const of::filesystem::path &path, bool bRelativeToData=true)
Definition ofFileUtils.cpp:1846
static std::string getPathForDirectory(const of::filesystem::path &path)
Definition ofFileUtils.cpp:1776
static std::string getBaseName(const of::filesystem::path &filePath)
Definition ofFileUtils.cpp:1822
static bool createEnclosingDirectory(const of::filesystem::path &filePath, bool bRelativeToData=true, bool bRecursive=true)
Definition ofFileUtils.cpp:1839
static std::string addTrailingSlash(const of::filesystem::path &path)
Definition ofFileUtils.cpp:1740
static std::string makeRelative(const of::filesystem::path &from, const of::filesystem::path &to)
Definition ofFileUtils.cpp:1936
static std::string addLeadingSlash(const of::filesystem::path &path)
Definition ofFileUtils.cpp:1726
static std::string getFileExt(const of::filesystem::path &filename)
Definition ofFileUtils.cpp:1761
static bool isAbsolute(const of::filesystem::path &path)
Definition ofFileUtils.cpp:1861
static std::string getFileName(const of::filesystem::path &filePath, bool bRelativeToData=true)
Definition ofFileUtils.cpp:1810
static std::string getCurrentWorkingDirectory()
Definition ofFileUtils.cpp:1866
static std::string join(const of::filesystem::path &path1, const of::filesystem::path &path2)
Definition ofFileUtils.cpp:1876
Definition ofEvents.cpp:625
bool ofBufferToFile(const of::filesystem::path &path, const ofBuffer &buffer, bool binary=true)
Definition ofFileUtils.cpp:460
void ofEnableDataPath()
Enable the use of the data path.
Definition ofFileUtils.cpp:1961
void ofSetDataPathRoot(const of::filesystem::path &root)
Set the relative path to the data/ folder from the executable.
Definition ofFileUtils.cpp:1981
ofBuffer ofBufferFromFile(const of::filesystem::path &path, bool binary=true)
Definition ofFileUtils.cpp:454
bool ofRestoreWorkingDirectoryToDefault()
Reset the working directory to the platform default.
Definition ofFileUtils.cpp:1971
void ofDisableDataPath()
Disable the use of the data path.
Definition ofFileUtils.cpp:1966
std::string ofToDataPath(const of::filesystem::path &path, bool absolute=false)
Make a path relative to the location of the data/ folder.
Definition ofFileUtils.cpp:1988
Definition ofFileUtils.h:149
Line & operator++()
Increment to the next line.
Definition ofFileUtils.cpp:313
std::forward_iterator_tag iterator_category
Definition ofFileUtils.h:156
bool empty() const
Is this line empty? (aka an empty string "")
Definition ofFileUtils.cpp:335
Definition ofFileUtils.h:211
RLine rend()
RLine rbegin()
Definition ofFileUtils.h:180
RLine & operator++()
Increment to the next line.
Definition ofFileUtils.cpp:374
std::forward_iterator_tag iterator_category
Definition ofFileUtils.h:187
bool empty() const
Is this line empty? (aka an empty string "")
Definition ofFileUtils.cpp:396
Definition ofFileUtils.h:230