本文整理汇总了C++中IFileSystem::getWorkingDirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ IFileSystem::getWorkingDirectory方法的具体用法?C++ IFileSystem::getWorkingDirectory怎么用?C++ IFileSystem::getWorkingDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFileSystem
的用法示例。
在下文中一共展示了IFileSystem::getWorkingDirectory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
//-------------------------------------------------------------------------
// i n i t
//-------------------------------------------------------------------------
int CApplication::init()
{
SIrrlichtCreationParameters cp;
static SKeyMap keyMap[5];
keyMap[0].Action = EKA_MOVE_FORWARD;
keyMap[0].KeyCode = KEY_KEY_W;
keyMap[1].Action = EKA_STRAFE_LEFT;
keyMap[1].KeyCode = KEY_KEY_A;
keyMap[2].Action = EKA_MOVE_BACKWARD;
keyMap[2].KeyCode = KEY_KEY_S;
keyMap[3].Action = EKA_STRAFE_RIGHT;
keyMap[3].KeyCode = KEY_KEY_D;
keyMap[4].Action = EKA_JUMP_UP;
keyMap[4].KeyCode = KEY_SPACE;
int result=0;
stringc msg;
// use null device for early file system access
IrrlichtDevice* m_nullDevice = createDevice(EDT_NULL);
IFileSystem* fileSystem = m_nullDevice->getFileSystem();
m_currentDirectory = fileSystem->getWorkingDirectory();
m_currentDirectory = fileSystem->flattenFilename(m_currentDirectory);
if(m_argv)
{
m_appExecutable = m_argv[0];
}
else
{
m_appExecutable = "irrlicht.exe";
}
stringc appBaseName;
appBaseName = fileSystem->getAbsolutePath(m_appExecutable);
appBaseName = fileSystem->getFileBasename(appBaseName, false);
//
// create log writer
//
m_logName = appBaseName;
m_logName += ".log";
m_logFile = fileSystem->createAndWriteFile(m_logName);
msg = "Created log file: ";
msg += m_logName;
logMessage(msg);
//
// configuration system
//
// locate the data directory - underneath our executable or outside of it.
stringc temp("data/");
if(!fileSystem->existFile(temp))
{
temp = "../data/";
// todo - look for "data.zip"...
}
m_dataRoot = fileSystem->getAbsolutePath(temp);
m_configName = m_dataRoot;
m_configName += "/cfg/";
m_configName += appBaseName;
m_configName += ".xml";
if(!fileSystem->existFile(m_configName))
{
// not in data/cfg or ../data/cfg so look in the working directory.
m_configName = appBaseName;
m_configName += ".xml";
if(!fileSystem->existFile(m_configName))
{
return -1;
}
}
// load the config file
m_config = new CXMLConfig();
if(!m_config->load(m_configName))
{
return -1;
}
// setup the device based on config settings
stringc sdriver = m_config->getString("driver","video","EDT_OPENGL");
cp.DriverType = EDT_OPENGL;
if(sdriver == "EDT_DIRECT3D9")
cp.DriverType = EDT_DIRECT3D9;
cp.WindowSize = m_config->getDimension("resolution","video",dimension2di(800, 600));
cp.Bits = m_config->getInt("colordepth","video",32);
cp.Fullscreen = m_config->getBool("fullscreen","video",false);
cp.Vsync = m_config->getBool("vsync","video",true);
cp.Stencilbuffer = m_config->getBool("stencilbuffer","video",false);
cp.AntiAlias = m_config->getInt("antialias","video",0);
//.........这里部分代码省略.........