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


C++ Path_t类代码示例

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


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

示例1: Path_t

int FuseContext::rmdir (const char *path)
{
    namespace fs = boost::filesystem;
    Path_t wrapped = m_realRoot / path;

    // first we make sure that the parent directory exists
    Path_t parent   = wrapped.parent_path();
    Path_t filename = wrapped.filename();

    if( !fs::exists(parent) )
      return -ENOENT;

    // unlink the directory holding the file contents, the meta file,
    // and the staged file
    fs::remove_all( wrapped );

    try
    {
        // remove the entry from the parent
        m_backend->db().unlink( Path_t(path) );
    }
    catch( const std::exception& ex )
    {
        std::cerr << "FuseContext::rmdir: "
              << "\n path: " << path
              << "\n real: " << wrapped
              << "\n  err: " << ex.what()
              << "\n";
    }

    return 0;
}
开发者ID:cheshirekow,项目名称:openbookfs,代码行数:32,代码来源:FuseContext.cpp

示例2: getattr

int FuseContext::getattr (const char *path, struct stat *out)
{
    namespace fs = boost::filesystem;
    Path_t wrapped = m_realRoot / path;

    int result = ::lstat( wrapped.c_str(), out );

    // if we failed to stat the underlying file, then check to see if the
    // file is unsubscribed
    if( result < 0 )
    {
        if( m_backend->db().isSubscribed( m_relDir / path ) )
            return -errno;
        else
        {
            out->st_mode  = S_IFREG | S_IRUSR | S_IWUSR;
            out->st_nlink = 0;
            out->st_uid   = getuid();
            out->st_gid   = getgid();
            out->st_size  = 0;
            out->st_atime = 0;
            out->st_mtime = 0;
            out->st_ctime = 0;

            return 0;
        }
    }

    return result;
}
开发者ID:cheshirekow,项目名称:openbookfs,代码行数:30,代码来源:FuseContext.cpp

示例3: FileString

bool rab::GatherSha1Files( Options const& options, Config const& config, Path_t const& relativePath, 
	FolderInfo::FileInfos_t const& fileInfos, LogOutput_t& out )
{
	int errors = 0;

	for( FolderInfo::FileInfos_t::const_iterator i = fileInfos.begin(); i != fileInfos.end(); ++i )
	{
		FileInfo& fileInfo = **i;

		Path_t fullOld = options.pathToOld / relativePath / fileInfo.name;

		dung::MemoryBlock oldFile;
		if( !dung::ReadWholeFile( fullOld.wstring(), oldFile ) )
		{
			out << "Can't read file " << FileString( fullOld ) << std::endl;
			errors++;
			continue;
		}
		
		dung::SHA1Compute( oldFile.pBlock, oldFile.size, fileInfo.oldSha1 );
		fileInfo.oldSize = oldFile.size;
	}

	return errors == 0;
}
开发者ID:WildGenie,项目名称:Scarab,代码行数:25,代码来源:filesha1.cpp

示例4: attr

int FuseContext::getxattr (const char *path,
                            const char *key,
                            char *value,
                            size_t bufsize)
{
    std::string attr(key);
    if( attr == "obfs:checkout" )
    {
        std::stringstream report;
        report << "FuseContext::getxattr : intercepted checkout hook for"
               << path <<"\n";
        std::cout << report.str();
        m_backend->checkout( m_relDir / path );
        return 0;
    }
    else if( attr == "obfs:release" )
    {
        std::stringstream report;
        report << "FuseContext::getxattr : intercepted release hook for"
               << path <<"\n";
        std::cout << report.str();
        m_backend->release( m_relDir / path );
        return 0;
    }
    else
    {
        Path_t wrapped = m_realRoot / path;
        int result = ::getxattr( wrapped.c_str(), key, value, bufsize );
        if( result < 0 )
            return -errno;

        return result;
    }

}
开发者ID:cheshirekow,项目名称:openbookfs,代码行数:35,代码来源:FuseContext.cpp

示例5:

_tstring rab::FileString( Path_t const& p )
{
#ifdef SCARAB_WCHAR_MODE
	return p.wstring();
#else
	return p.string();
#endif
}
开发者ID:WildGenie,项目名称:Scarab,代码行数:8,代码来源:rollaball.cpp

示例6: statfs

int FuseContext::statfs (const char *path, struct statvfs *buf)
{
    Path_t wrapped = m_realRoot / path;
    int result = ::statvfs( wrapped.c_str(), buf );
    if( result < 0 )
        return -errno;

    return result;
}
开发者ID:cheshirekow,项目名称:openbookfs,代码行数:9,代码来源:FuseContext.cpp

示例7: listxattr

int FuseContext::listxattr (const char *path, char *buf, size_t bufsize)
{
    Path_t wrapped = m_realRoot / path;
    int result = ::listxattr( wrapped.c_str(), buf, bufsize );
    if( result < 0 )
        return -errno;

    return result;
}
开发者ID:cheshirekow,项目名称:openbookfs,代码行数:9,代码来源:FuseContext.cpp

示例8: removexattr

int FuseContext::removexattr (const char *path, const char *key)
{
    Path_t wrapped = m_realRoot / path;
    int result = ::removexattr( wrapped.c_str(), key );
    if( result < 0 )
        return -errno;

    return result;
}
开发者ID:cheshirekow,项目名称:openbookfs,代码行数:9,代码来源:FuseContext.cpp

示例9: access

int FuseContext::access (const char *path, int mode)
{
    Path_t wrapped = m_realRoot / path;

    int result = ::access( wrapped.c_str(), mode );
    if( result < 0 )
        return -errno;

    return result;
}
开发者ID:cheshirekow,项目名称:openbookfs,代码行数:10,代码来源:FuseContext.cpp

示例10: link

int FuseContext::link (const char *oldpath, const char *newpath)
{
    Path_t oldwrap = m_realRoot / oldpath;
    Path_t newwrap = m_realRoot / newpath;

    int result = ::link( oldwrap.c_str(), newwrap.c_str() );
    if( result < 0 )
        return -errno;

    return result;
}
开发者ID:cheshirekow,项目名称:openbookfs,代码行数:11,代码来源:FuseContext.cpp

示例11: chown

int FuseContext::chown (const char *path, uid_t owner, gid_t group)
{
    namespace fs = boost::filesystem;
    Path_t wrapped = (m_realRoot / path);

    int result = ::chown( wrapped.c_str(), owner, group);
    if( result < 0 )
        return -errno;

    return result;
}
开发者ID:cheshirekow,项目名称:openbookfs,代码行数:11,代码来源:FuseContext.cpp

示例12: chmod

int FuseContext::chmod (const char *path, mode_t mode)
{
    namespace fs = boost::filesystem;
    Path_t wrapped = m_realRoot / path;

    // if it's not a directory
    int result = ::chmod( wrapped.c_str(), mode );
    if( result < 0 )
        return -errno;

    return result;
}
开发者ID:cheshirekow,项目名称:openbookfs,代码行数:12,代码来源:FuseContext.cpp

示例13: setxattr

int FuseContext::setxattr (const char *path,
                            const char *key,
                            const char *value,
                            size_t bufsize,
                            int flags)
{
    Path_t wrapped = m_realRoot / path;
    int result = ::setxattr( wrapped.c_str(), key, value, bufsize, flags );
    if( result < 0 )
        return -errno;

    return result;
}
开发者ID:cheshirekow,项目名称:openbookfs,代码行数:13,代码来源:FuseContext.cpp

示例14: read

int FuseContext::read (const char *path,
                        char *buf,
                        size_t bufsize,
                        off_t offset,
                        struct fuse_file_info *fi)
{
    namespace fs = boost::filesystem;
    Path_t wrapped = (m_realRoot / path);

    // if fi has a file handle then we simply read from the file handle
    if( fi->fh )
    {
        RefPtr<FileContext> file = m_openedFiles[fi->fh];
        if(file)
        {
            int result = ::pread(file->fd(),buf,bufsize,offset);
            if( result < 0 )
                return -errno;
            else
                return result;
        }
        else
            return -EBADF;
    }
    // otherwise we open the file and perform the read
    else
    {
        // open the local version of the file
        int result = ::open( wrapped.c_str(), O_RDONLY );
        if( result < 0 )
            return -errno;

        // get the file andle
        int fh = result;

        // perform the read
        result = ::pread(fh,buf,bufsize,offset);

        // close the file
        ::close(fh);

        if( result < 0 )
            return -errno;
        else
            return result;
    }


}
开发者ID:cheshirekow,项目名称:openbookfs,代码行数:49,代码来源:FuseContext.cpp

示例15:

MetaFile::MetaFile( const Path_t& path )
{
    namespace fs = boost::filesystem;
    Path_t metapath;

    if( fs::is_directory(path) )
    {
        metapath = path / "obfs.sqlite";
        m_subpath = ".";
    }
    else
    {
        metapath = path.parent_path() / "obfs.sqlite";
        m_subpath = path.filename().string();
    }
    m_sql.open( soci::sqlite3, metapath.string() );
}
开发者ID:balvisio,项目名称:openbookfs,代码行数:17,代码来源:MetaFile.cpp


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