本文整理汇总了C++中FSPath::GetUtf8方法的典型用法代码示例。如果您正苦于以下问题:C++ FSPath::GetUtf8方法的具体用法?C++ FSPath::GetUtf8怎么用?C++ FSPath::GetUtf8使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSPath
的用法示例。
在下文中一共展示了FSPath::GetUtf8方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Uri
// 2. Delegate file Uri to baseBS. Folder Uri is tmp:///folder/name#baseFSRootUri
// - appears to work
FSString FSTmp::Uri(FSPath& path)
{
FSTmpNode* n = rootDir.findByFsPath(&path);
if (n && n->nodeType == FSTmpNode::NODE_FILE)
return baseFS->Uri(n->baseFSPath);
else
{
std::string ret(std::string("tmp://") + path.GetUtf8('/') + "#" + baseFS->Uri(rootPathName).GetUtf8());
return FSString(ret.c_str());
}
}
示例2: Run
void OperRDThread::Run()
{
int n = 8;
int ret_err;
while (true)
{
if (!(fs->Flags() & FS::HAVE_SYMLINK))
break;
FSStat st;
if (fs->Stat(path, &st, &ret_err, Info()))
throw_msg("%s", fs->StrError(ret_err).GetUtf8());
if (!st.IsLnk())
break;
n--;
if (n<0)
throw_msg("too more symbolic links '%s'", path.GetUtf8());
path.Pop();
if (!ParzeLink(path, st.link))
throw_msg("invalid symbolic link '%s'", path.GetUtf8());
}
cptr<FSList> list = new FSList;
int ret = fs->ReadDir(list.ptr(), path, &ret_err, Info());
if (ret)
throw_msg("%s", fs->StrError(ret_err).GetUtf8());
MutexLock lock(Node().GetMutex()); //!!!
if (Node().NBStopped()) return;
OperRDData *data = ((OperRDData*)Node().Data());
data->list = list;
data->path = path;
data->executed = true;
}
示例3: Uri
FSString FSSmb::Uri( FSPath& path )
{
MutexLock lock( &mutex );
std::vector<char> a;
if ( _param.server[0] )
{
if ( _param.user[0] )
{
a = carray_cat<char>( "smb://", const_cast<char*>( _param.user ), "@", const_cast<char*>( _param.server ), path.GetUtf8() );
}
else
{
a = carray_cat<char>( "smb://", const_cast<char*>( _param.server ), path.GetUtf8() );
}
}
else
{
a = carray_cat<char>( "smb:/", path.GetUtf8() );
}
return FSString( CS_UTF8, a.data() );
}
示例4: GetFileSystemFreeSpace
int64 FSSys::GetFileSystemFreeSpace( FSPath& path, int* err )
{
#if defined( __linux__ ) && !defined( __APPLE__ )
struct statfs64 s;
if ( statfs64( path.GetUtf8(), &s ) == -1 )
{
SetError( err, errno );
return -1;
}
#else
// FreeBSD and probably other systems have 64 bit support in regular statfs
struct statfs s;
if ( statfs( path.GetUtf8(), &s ) == -1 )
{
SetError( err, errno );
return -1;
}
#endif
return ( int64 )( s.f_bfree ) * ( int64 )( s.f_bsize );
}
示例5: Uri
FSString FSSftp::Uri( FSPath& path )
{
MutexLock lock( &infoMutex ); //infoMutex!!!
std::vector<char> a;
char port[0x100];
snprintf( port, sizeof( port ), ":%i", _infoParam.port );
FSString server( _infoParam.server.Data() );
FSString user( _infoParam.user.Data() );
a = carray_cat<char>( "sftp://", user.GetUtf8(), "@", server.GetUtf8(), port, path.GetUtf8( '/' ) );
return FSString( CS_UTF8, a.data() );
}
示例6: Run
void OperRDThread::Run()
{
if ( !fs.Ptr() ) { return; }
int n = 8;
int ret_err;
int havePostponedStatError = 0;
FSString postponedStrError;
while ( true )
{
if ( !( fs->Flags() & FS::HAVE_SYMLINK ) )
{
break;
}
FSStat st;
// if path is inaccessible, try .. path. Throw the exception later
// This makes panel at least having some valid folder
while ( fs->Stat( path, &st, &ret_err, Info() ) )
{
havePostponedStatError = 1;
postponedStrError = fs->StrError( ret_err );
if ( !path.IsAbsolute() || path.Count() <= 1 || !path.Pop() )
{
throw_msg( "%s", postponedStrError.GetUtf8() );
}
}
// yell immediately if the path is inaccessible (orig behavior)
//if (fs->Stat(path, &st, &ret_err, Info()))
// throw_msg("%s", fs->StrError(ret_err).GetUtf8());
if ( !st.IsLnk() )
{
break;
}
n--;
if ( n < 0 )
{
throw_msg( "too many symbolic links '%s'", path.GetUtf8() );
}
path.Pop();
if ( !ParzeLink( path, st.link ) )
{
throw_msg( "invalid symbolic link '%s'", path.GetUtf8() );
}
}
clPtr<FSList> list = new FSList;
int havePostponedReadError = 0;
// if directory is not readable, try .. path. Throw the exception later
// "Stat" call above does not catch this: it checks only folder existence, but not accessibilly
while ( fs->ReadDir( list.ptr(), path, &ret_err, Info() ) )
{
havePostponedReadError = 1;
postponedStrError = fs->StrError( ret_err );
if ( !path.IsAbsolute() || path.Count() <= 1 || !path.Pop() )
{
throw_msg( "%s", postponedStrError.GetUtf8() );
}
}
// yell immediately if the dir is unreadable (orig behavior)
//int ret = fs->ReadDir(list.ptr(), path, &ret_err, Info());
//if (ret)
// throw_msg("%s", fs->StrError(ret_err).GetUtf8());
FSStatVfs vst;
fs->StatVfs( path, &vst, &ret_err, Info() );
MutexLock lock( Node().GetMutex() ); //!!!
if ( Node().NBStopped() ) { return; }
OperRDData* data = ( ( OperRDData* )Node().Data() );
data->list = list;
data->path = path;
data->executed = true;
data->vst = vst;
if ( havePostponedReadError || havePostponedStatError )
{
data->nonFatalErrorString = postponedStrError;
}
}
示例7: Uri
virtual FSString Uri( FSPath& path ) override
{
FSPath FilePath( m_Uri );
std::string ret( FilePath.GetItem( FilePath.Count() - 1 )->GetUtf8() + std::string( ":" ) + path.GetUtf8( '/' ) );
return FSString( ret.c_str() );
}