⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filesystem.h

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 H
📖 第 1 页 / 共 2 页
字号:
    */    static Boolean makeDirectory(const String& path);    /** Get the path of the current working Directory.        @param path set to current working directory upon return.        @return true on success (operation may fail if the current            working directory becomes stale; this can happen on            Unix if it is removed but is impossible on Windows            due to reference counting).    */    static Boolean getCurrentDirectory(String& path);    /** Remove the given directory. The directory must be empty        to be eligible for removal        @param String path is the relative or ablsolute path to        the directory to remove        @return true if directory removed    */    static Boolean removeDirectory(const String& path);    /** Remove a directory and all files and directories under it.        WARNING: This differs significantly from the <tt>removeDirectory</tt>        function in that it removes both directories and files and        removes a complete hiearchy.  Use with caution.        @param path path of directory to be removed.        @return true on success.    */    static Boolean removeDirectoryHier(const String& path);    /** Gets names of all entries (files and directories) of a directory.        Note that this function excludes the "." and ".." entries.        @param path path path of directory.        @param paths contains list of entry names upon return. Note that            the entry names only are provided (no path part).        @return true on success.    */    static Boolean getDirectoryContents(        const String& path,        Array<String>& paths);    /** Determines whether the given directory is empty. A directory is        empty if it contains no files or directories.        @param path path of directory.        @return true if directory is empty.    */    static Boolean isDirectoryEmpty(const String& path);    /** Translate backward slashes to forward slashes.        @param path to be translated.    */    static void translateSlashes(String& path);    /** Get an absolute path from an absolute directory and a relative or        absolute file name.  If the file name is fully specified, it is        returned unchanged.  Otherwise, the specified directory is prepended        to the file name.    */    static String getAbsolutePath(const char* path, const String& filename);    /** Return the just the filename to the file name into base.    */    static String extractFileName(const String& base);    /** Return the just the path to the file name into path.    */    static String extractFilePath(const String& path);    /** Changes file permissions on the given file.        @param path path of the file.        @param mode the bit-wise inclusive OR of the values for the        desired permissions.        @return true on success, false on error and errno is set appropriately.    */    static Boolean changeFilePermissions(const String& path, mode_t mode);    /**       Return OS path specific delimiter.       @return delimiter specific to the platform    */    static String getPathDelimiter();    /**       Returns the absolute pathname for the specified filename.       @param paths directories seperated by an OS specific delimiter to search       @param filename filename to search for in the paths       @return the full absolute pathname to the found filename or an empty       string on failure.    */    static String getAbsoluteFileName(        const String& paths,        const String& filename);    /**        Convert a library name to its corresponding file name by adding the        appropriate prefix and suffix.        @param libraryName The name of the library for which to build the file                           name.        @return The file name corresponding to the specified library name.    */    static String buildLibraryFileName(const String &libraryName);    static Boolean changeFileOwner(        const String& fileName,        const String& userName);private:    FileSystem() { }};inline Boolean FileSystem::existsNoCase(const String& path){    String dummy;    return existsNoCase(path, dummy);}inline Boolean FileSystem::canReadNoCase(const String& path){    String realPath;    if (!existsNoCase(path, realPath))        return false;    return FileSystem::canRead(realPath);}inline Boolean FileSystem::canWriteNoCase(const String& path){    String realPath;    if (!existsNoCase(path, realPath))        return false;    return FileSystem::canWrite(realPath);}inline Boolean FileSystem::removeFileNoCase(const String& path){    String realPath;    if (!existsNoCase(path, realPath))        return false;    return FileSystem::removeFile(realPath);}inline Boolean FileSystem::renameFileNoCase(    const String& oldPath,    const String& newPath){    String realPath;    if (!existsNoCase(oldPath, realPath))        return false;    return FileSystem::renameFile(realPath, newPath);}inline Boolean FileSystem::getFileSizeNoCase(const String& path, Uint32& size){    String realPath;    if (!existsNoCase(path, realPath))        return false;    return FileSystem::getFileSize(realPath, size);}inline String FileSystem::getAbsolutePath(    const char* path,    const String& filename){    String absolutePath;    if (filename != String::EMPTY)    {        if (!System::is_absolute_path(filename.getCString()) && path && path[0])        {            absolutePath.append(path);            absolutePath.append('/');        }        absolutePath.append(filename);    }    translateSlashes(absolutePath);    return absolutePath;}inline Boolean Open(PEGASUS_STD(ifstream)& is, const String& path){#if defined(PEGASUS_OS_OS400)    is.open(path.getCString(), PEGASUS_STD(_CCSID_T(1208)));#else    is.open(path.getCString());#endif    return !!is;}inline Boolean Open(PEGASUS_STD(ofstream)& os, const String& path){#if defined(PEGASUS_OS_OS400)    os.open(path.getCString(), PEGASUS_STD(_CCSID_T(1208)));#else    os.open(path.getCString());#endif    return !!os;}inline Boolean OpenAppend(PEGASUS_STD(ofstream)& os, const String& path){#if defined(PEGASUS_OS_OS400)    os.open(        path.getCString(), PEGASUS_STD(ios::app), PEGASUS_STD(_CCSID_T(1208)));#else    os.open(path.getCString(), PEGASUS_STD(ios::app));#endif    return !!os;}inline String FileSystem::getPathDelimiter(){#if defined(PEGASUS_OS_TYPE_WINDOWS)    return String(";");#else    return String(":");#endif}/** Get the next line from the input file.*/PEGASUS_COMMON_LINKAGE Boolean GetLine(PEGASUS_STD(istream)& is, String& line);PEGASUS_NAMESPACE_END#endif /* Pegasus_FileSystem_h */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -