]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/fileutl.h
rename the newly public CheckDirectory method to CreateAPTDirectoryIfNeeded
[apt.git] / apt-pkg / contrib / fileutl.h
index 62705478def3b8789fe1e291092c90e8a0510cd1..419506273fe230f94bc68f02ce123ce0476275c1 100644 (file)
@@ -46,7 +46,8 @@ class FileFd
    gzFile gz;
 
    public:
-   enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp,ReadOnlyGzip};
+   enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp,ReadOnlyGzip,
+                  WriteAtomic};
    
    inline bool Read(void *To,unsigned long Size,bool AllowEof)
    {
@@ -93,6 +94,15 @@ int GetLock(string File,bool Errors = true);
 bool FileExists(string File);
 bool DirectoryExists(string const &Path) __attrib_const;
 bool CreateDirectory(string const &Parent, string const &Path);
+
+/** \brief Ensure the existence of the given Path
+ *
+ *  \param Parent directory of the Path directory - a trailing
+ *  /apt/ will be removed before CreateDirectory call.
+ *  \param Path which should exist after (successful) call
+ */
+bool CreateAPTDirectoryIfNeeded(string const &Parent, string const &Path);
+
 std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ext,
                                        bool const &SortList, bool const &AllowNoExt=false);
 std::vector<string> GetListOfFilesInDir(string const &Dir, std::vector<string> const &Ext,