+ std::string toSafeFilesystemEncoding(os::file_access how = os::EXISTING) const;
+
+ /// returns true if the file exists
+ bool exists() const;
+ /// refreshes the file info
+ void refresh() const;
+ /// \return true if this object points to a symbolic link.
+ bool isSymLink() const;
+ /// \return true if the file is empty.
+ bool isFileEmpty() const;
+ /// returns time of last write access
+ std::time_t lastModified() const;
+ /// generates a checksum of a file
+ virtual unsigned long checksum() const;
+ /// return true when file is readable but not writable
+ bool isReadOnly() const;
+ /// return true when it names a directory
+ bool isDirectory() const;
+ /// return true when directory is readable
+ bool isReadableDirectory() const;
+ /// return true when it is a file and readable
+ virtual bool isReadableFile() const;
+ /// return true when file/directory is writable
+ bool isWritable() const;
+ /// return true when file/directory is writable (write test file)
+ bool isDirWritable() const;
+ /// \return list other files in the directory having optional extension 'ext'.
+ FileNameList dirList(std::string const & ext) const;
+
+ /// copy a file
+ /// \return true when file/directory is writable (write test file)
+ /// \warning This methods has different semantics when system level
+ /// copy command, it will overwrite the \c target file if it exists,
+ bool copyTo(FileName const & target) const;
+
+ /// remove pointed file.
+ /// \return true on success.
+ bool removeFile() const;
+
+ /// rename pointed file.
+ /// \return false if the operation fails or if the \param target file
+ /// already exists.
+ /// \return true on success.
+ bool renameTo(FileName const & target) const;
+
+ /// move pointed file to \param target.
+ /// \return true on success.
+ bool moveTo(FileName const & target) const;
+
+ /// change mode of pointed file.
+ /// This methods does nothing and return true on platforms that does not
+ /// support this.
+ /// \return true on success.
+ bool changePermission(unsigned long int mode) const;
+
+ /// remove pointed directory and all contents.
+ /// \return true on success.
+ bool destroyDirectory() const;
+ /// Creates pointed directory.
+ /// \return true on success.
+ bool createDirectory(int permissions) const;
+ /// Creates pointed path.
+ /// \return true on success.
+ bool createPath() const;
+
+ /// Get the contents of a file as a huge docstring.
+ /// \param encoding defines the encoding of the file contents.
+ /// Only four encodings are supported:
+ /// "UTF-8", "ascii", "latin1" and "local8bit" which uses the
+ /// current system locale.
+ docstring fileContents(std::string const & encoding) const;
+
+ /// Change extension.
+ /**
+ * If oldname does not have an extension, it is appended.
+ * If the extension is empty, any extension is removed from the name.
+ */
+ void changeExtension(std::string const & extension);
+
+ static FileName fromFilesystemEncoding(std::string const & name);
+ /// (securely) create a temporary file with the given mask.
+ /// \p mask must be in filesystem encoding, if it contains a
+ /// relative path, the template file will be created in the global
+ /// temporary directory as given by 'package().temp_dir()'.
+ static FileName tempName(std::string const & mask);
+ static FileName tempName(FileName const & temp_dir,
+ std::string const & mask);
+
+ /// get the current working directory
+ static FileName getcwd();
+
+ static FileName tempPath();
+
+ /// filename without path
+ std::string onlyFileName() const;
+ /// filename without path and without extension
+ std::string onlyFileNameWithoutExt() const;
+ /// only extension after the last dot.
+ std::string extension() const;
+ /** checks if the file has the given extension
+ on Windows and Mac it compares case insensitive */
+ bool hasExtension(const std::string & ext);
+ /// path without file name
+ FileName onlyPath() const;
+ /// path of parent directory
+ /// returns empty path for root directory
+ FileName parentPath() const;
+ /// used for display in the Gui
+ docstring displayName(int threshold = 1000) const;
+
+ /// change to a directory, return success
+ bool chdir() const;
+
+ /// \param buffer_path if empty, uses `pwd`
+ docstring const relPath(std::string const & path) const;
+
+ docstring const absoluteFilePath() const;
+
+private:
+ friend bool equivalent(FileName const &, FileName const &);
+ ///
+ struct Private;
+ Private * const d;