wxFileName NodeJSWorkspaceUser::GetFileName() const
{
    wxFileName workspaceFile(m_workspacePath);
    wxFileName fn(workspaceFile.GetPath(), workspaceFile.GetFullName() + ".nodejs." + clGetUserName());
    fn.AppendDir(".codelite");
    if(!fn.FileExists()) {
        fn.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
    }
    return fn;
}
Exemplo n.º 2
0
void PhpPlugin::OnNewWorkspace(clCommandEvent& e)
{
    e.Skip();
    if(e.GetString() == PHPWorkspace::Get()->GetWorkspaceType()) {
        e.Skip(false);
        // Create a PHP workspace
        NewPHPWorkspaceDlg newWspDlg(m_mgr->GetTheApp()->GetTopWindow());
        if(newWspDlg.ShowModal() == wxID_OK) {
            // Ensure that the workspace path exists
            wxFileName workspaceFile(newWspDlg.GetWorkspacePath());
            if(!workspaceFile.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL)) {
                ::wxMessageBox(wxString::Format(_("Could not create workspace folder:\n%s"), workspaceFile.GetPath()),
                    "CodeLite", wxICON_ERROR | wxOK | wxCENTER);
                return;
            }
            PHPWorkspace::Get()->Create(newWspDlg.GetWorkspacePath());
            DoOpenWorkspace(newWspDlg.GetWorkspacePath(), false /* create if missing */, newWspDlg.IsCreateProject());
        }
    }
}
Exemplo n.º 3
0
void NodeJSWorkspace::OnOpenWorkspace(clCommandEvent& event)
{
    event.Skip();
    wxFileName workspaceFile(event.GetFileName());

    // Test that this is our workspace
    NodeJSWorkspaceConfiguration conf;
    conf.Load(workspaceFile);
    if(!conf.IsOk()) {
        return;
    }
    // This is a NodeJS workspace, stop event processing by calling
    // event.Skip(false)
    event.Skip(false);

    // Check if this is a PHP workspace
    if(IsOpen()) {
        Close();
    }
    Open(workspaceFile);
}
Exemplo n.º 4
0
bool LocalWorkspace::SanityCheck()
{
    wxLogNull noLog;
    if(!clCxxWorkspaceST::Get()->IsOpen()) return false;

    wxFileName workspaceFile(clCxxWorkspaceST::Get()->GetWorkspaceFileName().GetFullPath());

    workspaceFile.AppendDir(".codelite");
    wxFileName localWspFile(m_fileName);
    localWspFile.SetExt("");

    // Check that the current workspace is the same as any previous Create()
    // If so, and assuming m_doc is valid, there's nothing more to do
    wxString localFile, globalFile;
    localFile = localWspFile.GetFullPath();
    globalFile = workspaceFile.GetFullPath();

    if((localFile == globalFile) && m_doc.IsOk()) { return true; }

    // If we're here, the class isn't correctly set up, so
    return Create();
}
Exemplo n.º 5
0
void PhpPlugin::OnOpenWorkspace(clCommandEvent& e)
{
    e.Skip();
    wxFileName workspaceFile(e.GetFileName());
    JSONRoot root(workspaceFile);
    if(!root.isOk()) return;

    wxString type = root.toElement().namedObject("metadata").namedObject("type").toString();
    bool hasProjects = root.toElement().hasNamedObject("projects");
    if(type == "php" || hasProjects) {
        // this is our to handle
        e.Skip(false);
    } else {
        return;
    }

    // Check if this is a PHP workspace
    if(PHPWorkspace::Get()->IsOpen()) {
        PHPWorkspace::Get()->Close(true, true);
    }
    DoOpenWorkspace(workspaceFile.GetFullPath());
}