Hot Door CORE  0.7.1
Adobe® Illustrator® Plug-in Library
hdicoreFiles.h
Go to the documentation of this file.
1 
7 #ifndef __HDI_CORE_FILE_MANIP__
8 #define __HDI_CORE_FILE_MANIP__
9 
10 #include <vector>
11 
12 #include "hdicoreTypes.h"
13 
14 namespace hdi
15 {
16  namespace core
17  {
18  namespace files
19  {
20  typedef std::vector<std::string> StringVector;
21 
30  bool exists(const std::string& filePath_);
31 
32  #if HDI_CORE_COMPILE_AI22_PLUS
33 
41  bool onNetwork(const std::string& filePath_);
42  #endif
43 
56  bool copy(const std::string& filePath_, const std::string& destPath_);
57 
69  bool rename(const std::string& filePath_, const std::string& newName_);
70 
82  bool move(const std::string& fromFilePath_, const std::string& toFolderPath_);
83 
92  int64_t getSize(const std::string& filePath_);
93 
104  std::string getTextContents(const std::string& filePath_);
105 
120  bool setTextContents(const std::string& filePath_, const std::string& contents_);
121 
134  bool getPermissions(const std::string& filePath_, mode_t& perms__);
135 
152  bool makeDirectory(const std::string& path_, const mode_t perms_);
153 
163  bool filesInDirectory(const std::string& path_, StringVector& files__);
164 
173  bool moveToTrash(const std::string& filePath_);
174 
187  bool ungzip(const std::string& sourcePath_, const std::string& destPath_);
188 
202  std::string platformPrefsPath(const std::string& subfolder_, const bool create_ = true);
203  }
204  }
205 }
206 
207 #endif
208 // __HDI_CORE_FILE_MANIP__
std::string getTextContents(const std::string &filePath_)
Gets the contents of a text-based file, assumed to be in UTF-8 encoding.
bool onNetwork(const std::string &filePath_)
Gets whether the given file is stored on a network drive.
bool exists(const std::string &filePath_)
Checks for the existence of a file or folder.
bool copy(const std::string &filePath_, const std::string &destPath_)
Copies a source file to a destination path.
bool move(const std::string &fromFilePath_, const std::string &toFolderPath_)
Moves a file from one location to another.
bool moveToTrash(const std::string &filePath_)
Moves a file to the Trash (Mac) or Recycle Bin (Windows)
Header file for a wide variety of necessary typedefs, enums, and forwards declarations.
std::string platformPrefsPath(const std::string &subfolder_, const bool create_=true)
Gets the prefs/registration/etc. folder path (given a subfolder inside it)
int64_t getSize(const std::string &filePath_)
Returns the size of a file in bytes.
bool rename(const std::string &filePath_, const std::string &newName_)
Renames a file.
Definition: hdicoreaiArray.h:12
bool ungzip(const std::string &sourcePath_, const std::string &destPath_)
Un-gzips a source file to a destination path.
bool filesInDirectory(const std::string &path_, StringVector &files__)
Cross-platform function to retrieve the names of every file in a given directory. ...
bool getPermissions(const std::string &filePath_, mode_t &perms__)
Gets the permission bits of a file or folder.
bool makeDirectory(const std::string &path_, const mode_t perms_)
Cross-platform function to create a directory at a given path with given permissions.
bool setTextContents(const std::string &filePath_, const std::string &contents_)
Sets the contents of a text-based file in UTF-8 encoding.