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


C++ FSPath::Pop方法代码示例

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


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

示例1: ParzeLink

bool ParzeLink( FSPath& path, FSString& link )
{
	FSPath t( link );

	if ( !path.IsAbsolute() && !t.IsAbsolute() ) { return false; } //не абсолютный путь

	int first = 0;

	if ( t.IsAbsolute() )
	{
		path.Clear();
		path.PushStr( FSString( "" ) );
		first = 1;
	}

	for ( int i = first; i < t.Count(); i++ )
	{
		FSString p = *( t.GetItem( i ) );

		if ( p.IsDot() ) { continue; }

		if ( p.Is2Dot() )
		{
			if ( path.Count() > 1 ) { path.Pop(); }
		}
		else
		{
			path.PushStr( p );
		}
	}

	return true;
}
开发者ID:KonstantinKuklin,项目名称:WalCommander,代码行数:33,代码来源:vfs.cpp

示例2: AddNode

bool FSTmp::AddNode(FSPath& srcPath, FSNode* fsNode, FSPath& destPath)
{
	FSPath parentDir = destPath;
	parentDir.Pop();
	//dbg_printf("FSTmp::AddNode srcPath.Count()=%d, parentDir.Count()=%d\n", srcPath.Count(), parentDir.Count());
	//srcPath.dbg_printf("FSTmp::AddNode srcPath=");
	//destPath.dbg_printf("FSTmp::AddNode destPath=");

	FSTmpNode* dn = rootDir.findByFsPath(&parentDir);
	if (!dn || dn->nodeType != FSTmpNode::NODE_DIR)
	{
		return false;
	}
	FSTmpNode fsTmpNode(&srcPath, &fsNode->st, dn);
	return dn->Add(&fsTmpNode);
}
开发者ID:0-wiz-0,项目名称:WCMCommander,代码行数:16,代码来源:vfs-tmp.cpp

示例3: 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;
}
开发者ID:Karamax,项目名称:WalCommander,代码行数:38,代码来源:fileopers.cpp

示例4: 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;
	}
}
开发者ID:FaionWeb,项目名称:WCMCommander,代码行数:96,代码来源:fileopers.cpp


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