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


C++ FileSystem::GetCurrentDir方法代码示例

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


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

示例1: Setup

void Player::Setup()
{
#if DESKTOP
    FileSystem* fs = GetFileSystem();
    engineParameters_[EP_RESOURCE_PREFIX_PATHS] = fs->GetProgramDir() + ";" + fs->GetCurrentDir();
#endif
    engineParameters_[EP_RESOURCE_PATHS] = "Cache;Resources";

    JSONFile file(context_);
    if (!file.LoadFile(ToString("%s%s", APK, "Settings.json")))
        return;

    for (auto& pair : file.GetRoot().GetObject())
        engineParameters_[pair.first] = pair.second.GetVariant();
}
开发者ID:rokups,项目名称:Urho3D,代码行数:15,代码来源:Player.cpp

示例2: Object

FileSelector::FileSelector(Context* context) :
    Object(context),
    directoryMode_(false),
    ignoreEvents_(false)
{
    window_ = new Window(context_);
    window_->SetLayout(LM_VERTICAL);

    titleLayout = new UIElement(context_);
    titleLayout->SetLayout(LM_HORIZONTAL);
    window_->AddChild(titleLayout);

    titleText_ = new Text(context_);
    titleLayout->AddChild(titleText_);

    closeButton_ = new Button(context_);
    titleLayout->AddChild(closeButton_);

    pathEdit_ = new LineEdit(context_);
    window_->AddChild(pathEdit_);

    fileList_ = new ListView(context_);
    window_->AddChild(fileList_);

    fileNameLayout_ = new UIElement(context_);
    fileNameLayout_->SetLayout(LM_HORIZONTAL);

    fileNameEdit_ = new LineEdit(context_);
    fileNameLayout_->AddChild(fileNameEdit_);

    filterList_ = new DropDownList(context_);
    fileNameLayout_->AddChild(filterList_);

    window_->AddChild(fileNameLayout_);

    buttonLayout_ = new UIElement(context_);
    buttonLayout_->SetLayout(LM_HORIZONTAL);

    buttonLayout_->AddChild(new UIElement(context_)); // Add spacer

    okButton_ = new Button(context_);
    okButtonText_ = new Text(context_);
    okButtonText_->SetAlignment(HA_CENTER, VA_CENTER);
    okButton_->AddChild(okButtonText_);
    buttonLayout_->AddChild(okButton_);

    buttonLayout_->AddChild(new UIElement(context_)); // Add spacer

    cancelButton_ = new Button(context_);
    cancelButtonText_ = new Text(context_);
    cancelButtonText_->SetAlignment(HA_CENTER, VA_CENTER);
    cancelButton_->AddChild(cancelButtonText_);
    buttonLayout_->AddChild(cancelButton_);

    buttonLayout_->AddChild(new UIElement(context_)); // Add spacer

    window_->AddChild(buttonLayout_);

    Vector<String> defaultFilters;
    defaultFilters.Push("*.*");
    SetFilters(defaultFilters, 0);
    FileSystem* fileSystem = GetSubsystem<FileSystem>();
    if (fileSystem)
        SetPath(fileSystem->GetCurrentDir());

    // Focus the fileselector's filelist initially when created, and bring to front
    UI* ui = GetSubsystem<UI>();
    if (ui)
    {
        ui->GetRoot()->AddChild(window_);
        ui->SetFocusElement(fileList_);
        window_->BringToFront();
    }

    SubscribeToEvent(filterList_, E_ITEMSELECTED, HANDLER(FileSelector, HandleFilterChanged));
    SubscribeToEvent(pathEdit_, E_TEXTFINISHED, HANDLER(FileSelector, HandlePathChanged));
    SubscribeToEvent(fileNameEdit_, E_TEXTFINISHED, HANDLER(FileSelector, HandleOKPressed));
    SubscribeToEvent(fileList_, E_ITEMSELECTED, HANDLER(FileSelector, HandleFileSelected));
    SubscribeToEvent(fileList_, E_ITEMDOUBLECLICKED, HANDLER(FileSelector, HandleFileDoubleClicked));
    SubscribeToEvent(fileList_, E_UNHANDLEDKEY, HANDLER(FileSelector, HandleFileListKey));
    SubscribeToEvent(okButton_, E_RELEASED, HANDLER(FileSelector, HandleOKPressed));
    SubscribeToEvent(cancelButton_, E_RELEASED, HANDLER(FileSelector, HandleCancelPressed));
    SubscribeToEvent(closeButton_, E_RELEASED, HANDLER(FileSelector, HandleCancelPressed));
}
开发者ID:jjiezheng,项目名称:urho3d,代码行数:84,代码来源:FileSelector.cpp

示例3: Start

void AtomicTool::Start()
{
    // Subscribe to events
    SubscribeToEvent(E_COMMANDERROR, HANDLER(AtomicTool, HandleCommandError));
    SubscribeToEvent(E_COMMANDFINISHED, HANDLER(AtomicTool, HandleCommandFinished));

    SubscribeToEvent(E_LICENSE_EULAREQUIRED, HANDLER(AtomicTool, HandleLicenseEulaRequired));
    SubscribeToEvent(E_LICENSE_ACTIVATIONREQUIRED, HANDLER(AtomicTool, HandleLicenseActivationRequired));
    SubscribeToEvent(E_LICENSE_ERROR, HANDLER(AtomicTool, HandleLicenseError));
    SubscribeToEvent(E_LICENSE_SUCCESS, HANDLER(AtomicTool, HandleLicenseSuccess));

    const Vector<String>& arguments = GetArguments();

    ToolSystem* tsystem = new ToolSystem(context_);
    context_->RegisterSubsystem(tsystem);

    ToolEnvironment* env = new ToolEnvironment(context_);
    context_->RegisterSubsystem(env);

//#ifdef ATOMIC_DEV_BUILD

    if (!env->InitFromJSON())
    {
        ErrorExit(ToString("Unable to initialize tool environment from %s", env->GetDevConfigFilename().CString()));
        return;
    }

    if (!cliDataPath_.Length())
    {
        cliDataPath_ = env->GetRootSourceDir() + "/Resources/";
    }

//#endif

    tsystem->SetCLI();
    tsystem->SetDataPath(cliDataPath_);


    if (activationKey_.Length())
    {
        DoActivation();
        return;
    } else if (deactivate_)
    {
        DoDeactivation();
        return;
    }

    BuildSystem* buildSystem = GetSubsystem<BuildSystem>();

    SharedPtr<CommandParser> parser(new CommandParser(context_));

    SharedPtr<Command> cmd(parser->Parse(arguments));
    if (!cmd)
    {
        String error = "No command found";

        if (parser->GetErrorMessage().Length())
            error = parser->GetErrorMessage();

        ErrorExit(error);
        return;
    }

    if (cmd->RequiresProjectLoad())
    {
        FileSystem* fileSystem = GetSubsystem<FileSystem>();

        String projectDirectory = fileSystem->GetCurrentDir();

        Vector<String> projectFiles;
        fileSystem->ScanDir(projectFiles, projectDirectory, "*.atomic", SCAN_FILES, false);
        if (!projectFiles.Size())
        {
            ErrorExit(ToString("No .atomic project file in %s", projectDirectory.CString()));
            return;
        }
        else if (projectFiles.Size() > 1)
        {
            ErrorExit(ToString("Multiple .atomic project files found in %s", projectDirectory.CString()));
            return;
        }

        String projectFile = projectDirectory + "/" + projectFiles[0];

        if (!tsystem->LoadProject(projectFile))
        {
            //ErrorExit(ToString("Failed to load project: %s", projectFile.CString()));
            //return;
        }

        // Set the build path
        String buildFolder = projectDirectory + "/" + "Build";
        buildSystem->SetBuildPath(buildFolder);

        if (!fileSystem->DirExists(buildFolder))
        {
            fileSystem->CreateDir(buildFolder);

            if (!fileSystem->DirExists(buildFolder))
//.........这里部分代码省略.........
开发者ID:AliAkbarMontazeri,项目名称:AtomicGameEngine,代码行数:101,代码来源:AtomicTool.cpp


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