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


C++ path::filename方法代码示例

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


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

示例1: CreateOrUpdate

	bool Taskbar::CreateOrUpdate(fs::path const& target_path) 
	{
		try
		{
			if (base::win::version() >= base::win::VERSION_WIN7)
			{
				fs::path shortcut_path = base::path::get(base::path::DIR_TEMP) / target_path.filename().replace_extension(L".lnk");

				if (!detail::CreateOrUpdateShortcutLink(shortcut_path, target_path))
				{
					throw std::domain_error(("Couldn't create or update shortcut at " + shortcut_path.string()).c_str());
				}

				bool result = detail::TaskbarPinShortcutLink(shortcut_path);
				fs::remove(shortcut_path);
				return result;
			}
			else
			{
				fs::path shortcut_path = base::path::get(base::path::DIR_USER_QUICK_LAUNCH) / target_path.filename().replace_extension(L".lnk");

				return detail::CreateOrUpdateShortcutLink(shortcut_path, target_path);
			}
		}
		catch (...)
		{
		}

		return false;
	}
开发者ID:benny5609,项目名称:YDWE,代码行数:30,代码来源:Shortcuts.cpp

示例2: CreateOrUpdate

	bool Taskbar::CreateOrUpdate(fs::path const& target_path) 
	{
		try
		{
			if (bee::platform::get_version().ver >= bee::platform::WinVer::Win10)
			{
			}
			else if (bee::platform::get_version().ver >= bee::platform::WinVer::Win7)
			{
				fs::path shortcut_path = fs::temp_directory_path() / target_path.filename().replace_extension(L".lnk");

				if (!detail::CreateOrUpdateShortcutLink(shortcut_path, target_path))
				{
					throw std::domain_error(("Couldn't create or update shortcut at " + shortcut_path.string()).c_str());
				}

				bool result = detail::TaskbarPinShortcutLink(shortcut_path);
				fs::remove(shortcut_path);
				return result;
			}
			else
			{
				fs::path shortcut_path = detail::quick_launch_path() / target_path.filename().replace_extension(L".lnk");

				return detail::CreateOrUpdateShortcutLink(shortcut_path, target_path);
			}
		}
		catch (...)
		{
		}

		return false;
	}
开发者ID:actboy168,项目名称:YDWE,代码行数:33,代码来源:Shortcuts.cpp

示例3: loadMovieFile

void ocvOpticalFlowApp::loadMovieFile( const fs::path &moviePath )
{
	try {
		// load up the movie, set it to loop, and begin playing
    	mMovie = qtime::MovieSurface( moviePath );    
		mMovie.setLoop();
		mMovie.play();
		
		// create a texture for showing some info about the movie
		TextLayout infoText;
		infoText.clear( ColorA( 0.2f, 0.2f, 0.2f, 0.5f ) );
		infoText.setColor( Color::white() );
		infoText.addCenteredLine( moviePath.filename().string() );
		infoText.addLine( toString( mMovie.getWidth() ) + " x " + toString( mMovie.getHeight() ) + " pixels" );
		infoText.addLine( toString( mMovie.getDuration() ) + " seconds" );
		infoText.addLine( toString( mMovie.getNumFrames() ) + " frames" );
		infoText.addLine( toString( mMovie.getFramerate() ) + " fps" );
		infoText.setBorder( 4, 2 );
		mInfoTexture = gl::Texture( infoText.render( true ) );
	}
	catch( ... ) {
		console() << "Unable to load the movie." << std::endl;
		mMovie.reset();
		mInfoTexture.reset();
	}
    
	mFrameTexture.reset();
}
开发者ID:redsonola,项目名称:InteractiveTangoMilonga,代码行数:28,代码来源:ocvOpticalFlowApp.cpp

示例4: trash

void trm::Database::createEntry(fs::path path, fs::path trashPath, std::size_t size)
{
    sqlite3_stmt *stmt;
    std::string objectName = trashPath.filename().string();
    const char *cPath = path.remove_filename().c_str();

    char sql[] =  "INSERT INTO trash (OBJECTNAME, FILESIZE, TRASHPATH, OLDPATH, DELETEDAT) "
                        "VALUES (?, ?, ?, ?, datetime('NOW', 'localtime'));";
    dbStatus = sqlite3_prepare(db, sql, -1, &stmt, 0);
    if (dbStatus != SQLITE_OK)
    {
        std::cout << "Database Error: " << errMsg << std::endl;
        exit(0);
    }

    if (sqlite3_bind_text(stmt, 1, objectName.c_str(), -1, SQLITE_STATIC) != SQLITE_OK)
        std::cout << "Database Bind Error: " << sqlite3_errmsg(db) << std::endl;
    if (sqlite3_bind_int(stmt, 2, static_cast<int>(size)) != SQLITE_OK)
        std::cout << "Database Bind Error: " << sqlite3_errmsg(db) << std::endl;
    if (sqlite3_bind_text(stmt, 3, trashPath.c_str(), -1, SQLITE_STATIC) != SQLITE_OK)
        std::cout << "Database Bind Error: " << sqlite3_errmsg(db) << std::endl;
    if (sqlite3_bind_text(stmt, 4, cPath, -1, SQLITE_STATIC))
        std::cout << "Database Bind Error: " << sqlite3_errmsg(db) << std::endl;

    if (sqlite3_step(stmt) != SQLITE_DONE)
        std::cout << "Database Execute Error: " << sqlite3_errmsg(db) << std::endl;
}
开发者ID:bennisen,项目名称:TrashManager,代码行数:27,代码来源:database.cpp

示例5: compile

bool CCompilerDriver::compile(const fs::path &inputPath, const fs::path &outputPath)
{
    string intermediateName = "__" + outputPath.filename().generic_string() + ".cpp";
    fs::path intermediatePath = outputPath;
    intermediatePath.remove_filename();
    intermediatePath /= intermediateName;

    string code;
    if (!generateCode(inputPath, code))
    {
        return false;
    }

    ofstream out;
    out.open(intermediatePath.generic_string().c_str(), ofstream::out);
    out.write(code.c_str(), code.size());
    out.close();

    stringstream command;
    command << "clang++ " << intermediatePath << " -o " << outputPath;
    cout << "Executing: " << command.str() << std::endl;
    system(command.str().c_str());

    return true;
}
开发者ID:ps-group,项目名称:minijavac,代码行数:25,代码来源:compilerdriver.cpp

示例6: resolve

fs::path FileResolver::resolve(const fs::path &path) const {
	/* First, try to resolve in case-sensitive mode */
	for (size_t i=0; i<m_paths.size(); i++) {
		fs::path newPath = m_paths[i] / path;
		if (fs::exists(newPath))
			return newPath;
	}

	#if defined(__LINUX__)
		/* On Linux, also try case-insensitive mode if the above failed */
		fs::path parentPath = path.parent_path();
		std::string filename = boost::to_lower_copy(path.filename().string());

		for (size_t i=0; i<m_paths.size(); i++) {
			fs::path path = m_paths[i] / parentPath;

			if (!fs::is_directory(path))
				continue;

			fs::directory_iterator end, it(path);
			for (; it != end; ++it) {
				if (boost::algorithm::to_lower_copy(it->path().filename().string()) == filename)
					return it->path();
			}
		}
	#endif

	return path;
}
开发者ID:AdrianJohnston,项目名称:ShapeNetRender,代码行数:29,代码来源:fresolver.cpp

示例7: playAudio

void AudioVisualizerApp::playAudio( const fs::path& file )
{
	FMOD_RESULT err;

	// ignore if this is not a file
	if( file.empty() || !fs::is_regular_file( file ) )
		return;

	// if audio is already playing, stop it first
	stopAudio();

	// stream the audio
	err = mFMODSystem->createStream( file.string().c_str(), FMOD_SOFTWARE, NULL, &mFMODSound );
	err = mFMODSystem->playSound( FMOD_CHANNEL_FREE, mFMODSound, false, &mFMODChannel );

	// we want to be notified of channel events
	err = mFMODChannel->setCallback( channelCallback );

	// keep track of the audio file
	mAudioPath = file;
	mIsAudioPlaying = true;

	// 
	console() << "Now playing:" << mAudioPath.filename() << std::endl;
}
开发者ID:UIKit0,项目名称:Cinder-Samples,代码行数:25,代码来源:AudioVisualizerApp.cpp

示例8: loadMovieFile

void QuickTimeSampleApp::loadMovieFile( const fs::path &moviePath )
{
	try {
		// load up the movie, set it to loop, and begin playing
		mMovie = qtime::MovieGl::create( moviePath );
		mMovie->setLoop();
		mMovie->play();
		
		// create a texture for showing some info about the movie
		TextLayout infoText;
		infoText.clear( ColorA( 0.2f, 0.2f, 0.2f, 0.5f ) );
		infoText.setColor( Color::white() );
		infoText.addCenteredLine( moviePath.filename().string() );
		infoText.addLine( toString( mMovie->getWidth() ) + " x " + toString( mMovie->getHeight() ) + " pixels" );
		infoText.addLine( toString( mMovie->getDuration() ) + " seconds" );
		infoText.addLine( toString( mMovie->getNumFrames() ) + " frames" );
		infoText.addLine( toString( mMovie->getFramerate() ) + " fps" );
		infoText.setBorder( 4, 2 );
		mInfoTexture = gl::Texture::create( infoText.render( true ) );
	}
	catch( ci::Exception &exc ) {
		console() << "Exception caught trying to load the movie from path: " << moviePath << ", what: " << exc.what() << std::endl;
		mMovie.reset();
		mInfoTexture.reset();
	}

	mFrameTexture.reset();
}
开发者ID:ChristophPacher,项目名称:Cinder,代码行数:28,代码来源:QuickTimeBasicApp.cpp

示例9: loadShader

void redEyeApp::loadShader() {
    mError= "";
    try {
        mTimeFrag= fs::last_write_time(mPathFrag);
        mTimeVert= fs::last_write_time(mPathVert);
        mNameFrag= mPathFrag.filename().string();
        mNameVert= mPathVert.filename().string();
        mShader= gl::GlslProg::create(loadFile(mPathVert), loadFile(mPathFrag), NULL);
    }
    catch(gl::GlslProgCompileExc &exc) {
        mError= exc.what();
    }
    catch(...) {
        mError= "Unable to load shader";
    }
}
开发者ID:redFrik,项目名称:redEye,代码行数:16,代码来源:redEyeApp.cpp

示例10: put

bool can::put(const fs::path& path)
{
	int i = 0;
	std::ostringstream oss;
	std::string name;
	do
	{
		oss.str("");
		oss << path.filename().string()
			<< " - " << trashinfo::get_current_time()
			<< " - " << i;
		name = oss.str();
		oss << ".trashinfo";
		try
		{
			trashinfo::create(this->info.as<fs::path>() / oss.str(), path);
			i = 0;
		}
		catch(const std::runtime_error& e)
		{
			i++;
		}
	} while (i > 0);

	boost::system::error_code ec;

	fs::rename(fs::absolute(path), this->files.as<fs::path>() / name, ec);

	return !ec;
}
开发者ID:Aethelflaed,项目名称:trash,代码行数:30,代码来源:can.cpp

示例11: load

void QTimeline::load( fs::path filepath )
{
    clear();
 
    XmlTree doc;
    
    try
    {
        doc = XmlTree( loadFile( filepath ) );

        
        for( XmlTree::Iter nodeIt = doc.begin("QTimeline/tracks/track"); nodeIt != doc.end(); ++nodeIt )
        {
            string              trackName   = nodeIt->getAttributeValue<string>("name");
            QTimelineTrackRef   trackRef    = QTimelineTrackRef( new QTimelineTrack( trackName ) );
            mTracks.push_back( trackRef );
            trackRef->loadXmlNode( *nodeIt );
        }
        
        mCueManager->loadXmlNode( doc.getChild( "qTimeline/cueList" ) );
    }
    catch ( ... )
    {
        console() << "Error > QTimeline::load(): " << filepath.filename().generic_string() << endl;
        return;
    }
    
    updateCurrentTime();
}
开发者ID:Reymenta-Visuals,项目名称:QTimeline,代码行数:29,代码来源:QTimeline.cpp

示例12: loadMovieFile

void DXTencoderApp::loadMovieFile( const fs::path &moviePath )
{
    try {
        mMovie = qtime::MovieSurface::create( moviePath );
        
        console() << "Dimensions:" << mMovie->getWidth() << " x " << mMovie->getHeight() << std::endl;
        console() << "Duration:  " << mMovie->getDuration() << " seconds" << std::endl;
        console() << "Frames:    " << mMovie->getNumFrames() << std::endl;
        console() << "Framerate: " << mMovie->getFramerate() << std::endl;
        console() << "Has audio: " << mMovie->hasAudio() << " Has visuals: " << mMovie->hasVisuals() << std::endl;

        mMovie->setLoop( false );
        mMovie->seekToStart();
        //mMovie->play();
        isStarted = true;
        currentFrame = 0;

        
        std::string basePath = moviePath.parent_path().string();
        string newFilename =   moviePath.filename().string();
        strReplace(newFilename, moviePath.extension().string(), ".dxt5");
                                                  
        mDxtCreator.open(basePath + "/" + newFilename);

    }
    catch( ci::Exception &exc ) {
        console() << "Exception caught trying to load the movie from path: " << moviePath << ", what: " << exc.what() << std::endl;
    }
    
    
    
}
开发者ID:lab101,项目名称:Cinder-DXT,代码行数:32,代码来源:DXT_encoder_GUIApp.cpp

示例13: reloadAsset

void AssetReloader::reloadAsset( fs::path assetPath )
{
    
    //    console() << "reload :: " << mKeyList[ assetPath.c_str() ] << endl;
    
    string key = "";
    key = mKeyList[ assetPath.c_str() ];
    
    if( key != "" ){
        console() << "AssetReloader :: reloading asset :: " << assetPath.filename() << endl;
        load( assetPath.filename(), key );
        // fire signal
        sAssetReloaded();
    }else{
        console() << "AssetReloader :: can't reload " << assetPath.filename() << endl;
    }
}
开发者ID:cwhitney,项目名称:AssetReloader,代码行数:17,代码来源:AssetReloader.cpp

示例14: dealStack

/*
 * Deal the stacks into separated files and append them.
 */
void dealStack(const fs::path &outdir, const std::string &prefix,
               const fs::path &imgPath,
               const uint16_t nLayer) {
	TIFF *in, *out;
    static uint16_t iLayer = 0;

    // Suppress the warnings.
	TIFFErrorHandler oldhandler = TIFFSetWarningHandler(NULL);

	// Open the file.
	in = TIFFOpen(imgPath.string().c_str(), "r");
	if (in == NULL) {
		std::cerr << "Unable to read " << imgPath.filename() << std::endl;
		return;
	}

    // Identify the read mode.
	static char mode[3] = { 'x', 'b', 0 };
    // Overwrite on the first run, and append for rest of the page.
    mode[0] = (mode[0] == 'x') ? 'w' : 'a';
    mode[1] = (TIFFIsBigEndian(in)) ? 'b' : 'l';

	// Iterate through the directories.
	int iFile = 0;
	do {
        std::string s = genPath(outdir, prefix, iFile);
		out = TIFFOpen(s.c_str(), mode);
        try {
    		if (out == NULL) {
                throw -1;
    		} else if (!cpTiff(in, out, iLayer, nLayer)) {
                throw -2;
    		}
        } catch (int e) {
            if (e == -1) {
                std::cerr << "Unable to create output file" << std::endl;
            } else if (e == -2) {
                std::cerr << "Unable to copy the layer" << std::endl;
            } else {
                std::cerr << "Unknown error" << std::endl;
            }
            TIFFClose(in);
            TIFFClose(out);
            return;
        }
		TIFFClose(out);
		iFile++;
	} while (TIFFReadDirectory(in));

    // Increment the layer variable for next write.
    iLayer++;

	TIFFClose(in);

    // Restore the warning.
	TIFFSetWarningHandler(oldhandler);
}
开发者ID:liuyenting,项目名称:python-tiff-transpose,代码行数:60,代码来源:tiff.cpp

示例15: is_html_file

bool bcp_implementation::is_html_file(const fs::path& p)
{
   static const boost::regex e(
      ".*\\."
      "(?:"
         "html?|css"
      ")"
      );
   return boost::regex_match(p.filename().generic_string(), e);
}
开发者ID:0xDEC0DE8,项目名称:mcsema,代码行数:10,代码来源:file_types.cpp


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