当前位置: 首页>>代码示例>>C++>>正文


C++ SdBaseFile::isDir方法代码示例

本文整理汇总了C++中SdBaseFile::isDir方法的典型用法代码示例。如果您正苦于以下问题:C++ SdBaseFile::isDir方法的具体用法?C++ SdBaseFile::isDir怎么用?C++ SdBaseFile::isDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SdBaseFile的用法示例。


在下文中一共展示了SdBaseFile::isDir方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: chdir

/** Change a volume's working directory
 *
 * Changes the volume working directory to the \a path subdirectory.
 * Optionally set the current working directory to the volume's
 * working directory.
 *
 * Example: If the volume's working directory is "/DIR", chdir("SUB")
 * will change the volume's working directory from "/DIR" to "/DIR/SUB".
 *
 * If path is "/", the volume's working directory will be changed to the
 * root directory
 *
 * \param[in] path The name of the subdirectory.
 *
 * \param[in] set_cwd Set the current working directory to this volume's
 *  working directory if true.
 *
 * \return The value one, true, is returned for success and
 * the value zero, false, is returned for failure.
 */
bool SdFat::chdir(const char *path, bool set_cwd) {
    SdBaseFile dir;
    if (path[0] == '/' && path[1] == '\0') return chdir(set_cwd);
    if (!dir.open(&m_vwd, path, O_READ)) goto fail;
    if (!dir.isDir()) goto fail;
    m_vwd = dir;
    if (set_cwd) SdBaseFile::setCwd(&m_vwd);
    return true;

fail:
    return false;
}
开发者ID:Console32,项目名称:waspmoteapi,代码行数:32,代码来源:SdFat.cpp

示例2: JSONFileInfo

void SDCard::JSONFileInfo(const char* filename) {
    SdBaseFile targetFile;
    GCodeFileInfo *info,tmpInfo;
    if (strlen(filename) == 0)  {
        targetFile = file;
        info = &fileInfo;
    } else {
        if (!targetFile.open(fat.vwd(), filename, O_READ) || targetFile.isDir()) {
            Com::printF(Com::tJSONErrorStart);
            Com::printF(Com::tFileOpenFailed);
            Com::printFLN(Com::tJSONErrorEnd);
            return;
        }
        info = &tmpInfo;
        info->init(targetFile);
    }
    if (!targetFile.isOpen()) {
        Com::printF(Com::tJSONErrorStart);
        Com::printF(Com::tNotSDPrinting);
        Com::printFLN(Com::tJSONErrorEnd);
        return;
    }

    // {"err":0,"size":457574,"height":4.00,"layerHeight":0.25,"filament":[6556.3],"generatedBy":"Slic3r 1.1.7 on 2014-11-09 at 17:11:32"}
    Com::printF(Com::tJSONFileInfoStart);
    Com::print(info->fileSize);
    Com::printF(Com::tJSONFileInfoHeight);
    Com::print(info->objectHeight);
    Com::printF(Com::tJSONFileInfoLayerHeight);
    Com::print(info->layerHeight);
    Com::printF(Com::tJSONFileInfoFilament);
    Com::print(info->filamentNeeded);
    Com::printF(Com::tJSONFileInfoGeneratedBy);
    Com::print(info->generatedBy);
    Com::print('"');
    if (strlen(filename) == 0) {
        Com::printF(Com::tJSONFileInfoName);
        file.printName();
        Com::print('"');
    }
    Com::print('}');
    Com::println();
};
开发者ID:perivar,项目名称:PulpitRockCNC3D,代码行数:43,代码来源:SDCard.cpp

示例3: lsJSON

void SDCard::lsJSON(const char *filename)
{
    SdBaseFile dir;
    fat.chdir();
    if (*filename == 0) {
        dir.openRoot(fat.vol());
    } else {
        if (!dir.open(fat.vwd(), filename, O_READ) || !dir.isDir()) {
            Com::printF(Com::tJSONErrorStart);
            Com::printF(Com::tFileOpenFailed);
            Com::printFLN(Com::tJSONErrorEnd);
            return;
        }
    }

    Com::printF(Com::tJSONDir);
    SDCard::printEscapeChars(filename);
    Com::printF(Com::tJSONFiles);
    dir.lsJSON();
    Com::printFLN(Com::tJSONArrayEnd);
}
开发者ID:perivar,项目名称:PulpitRockCNC3D,代码行数:21,代码来源:SDCard.cpp


注:本文中的SdBaseFile::isDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。