本文整理汇总了C++中FileStream::writeString方法的典型用法代码示例。如果您正苦于以下问题:C++ FileStream::writeString方法的具体用法?C++ FileStream::writeString怎么用?C++ FileStream::writeString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileStream
的用法示例。
在下文中一共展示了FileStream::writeString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: transferSysFiles
bool transferSysFiles( Options &options, bool bJustScript )
{
Path binpath, libpath;
// Under windows, the binary path is usually stored in an envvar.
String envpath;
if ( ! Sys::_getEnv( "FALCON_BIN_PATH", envpath ) || envpath == "" )
envpath = FALCON_DEFAULT_BIN;
binpath.setFullLocation(
options.m_sFalconBinDir != "" ? options.m_sFalconBinDir: envpath );
// copy falcon or falrun
if ( options.m_sRunner != "" )
binpath.setFilename( options.m_sRunner );
else
binpath.setFilename( "falcon.exe" );
// our dlls are in bin, under windows.
libpath.setFullLocation(
options.m_sFalconLibDir != "" ? options.m_sFalconLibDir : envpath );
if ( ! bJustScript )
{
Path tgtpath( options.m_sTargetDir + "/" + options.m_sSystemRoot +"/" );
libpath.setFile( "falcon_engine" );
libpath.setExtension( DllLoader::dllExt() );
tgtpath.setFilename( binpath.getFilename() );
if( ! copyFile( binpath.get(), tgtpath.get() ) )
{
warning( "Can't copy system file \"" + binpath.get()
+ "\" into target path \""+ tgtpath.get()+ "\"" );
// but continue
}
tgtpath.setFilename( libpath.getFilename() );
if( ! copyFile( libpath.get(), tgtpath.get() ) )
{
warning( "Can't copy system file \"" + libpath.get()
+ "\" into target path \""+ tgtpath.get()+ "\"" );
// but continue
}
// and now the visual C runtime, if any
copyRuntime( binpath, tgtpath );
}
// now create the startup script
Path mainScriptPath( options.m_sMainScript );
Path scriptPath( options.m_sTargetDir + "/" + mainScriptPath.getFile() + ".bat" );
message( "Creating startup script \"" + scriptPath.get() + "\"" );
FileStream startScript;
if( ! startScript.create( scriptPath.get(), (BaseFileStream::t_attributes) 0777 ) )
{
error( "Can't create startup script \"" + scriptPath.get() + "\"" );
return false;
}
startScript.writeString(
"@ECHO OFF\r\n"
"set OLD_DIR=%CD%\r\n"
"set target_dir=%~dp0\r\n"
"cd %target_dir%\r\n");
if( bJustScript )
{
startScript.writeString( "\"" + binpath.getFilename() + "\" " );
}
else
{
startScript.writeString( " \""+options.m_sSystemRoot + "\\" + binpath.getFilename() + "\" " );
startScript.writeString( " -L \"" + options.m_sSystemRoot +";.\" " );
}
// we need to discard the extension, so that the runner decides how to run the program.
Path scriptName( options.m_sMainScript );
startScript.writeString( " \"" + scriptName.getFile() +"\" \"%*\"\r\n" );
startScript.writeString( "cd %OLD_DIR%\r\n" );
startScript.flush();
return true;
}