Пример #1
0
bool wxExVCS::Execute()
{
  const wxExFileName filename(GetFile());

  if (!filename.IsOk())
  {
    return m_Entry.Execute(
      m_Entry.GetCommand().IsAdd() ? wxExConfigFirstOf(_("Path")): std::string(), 
      wxExLexer(), 
      true,
      wxExConfigFirstOf(_("Base folder")));
  }
  else
  {
    std::string args;
    std::string wd;
    
    if (m_Files.size() > 1)
    {
      for (const auto& it : m_Files)
      {
        args += "\"" + it + "\" ";
      }
    }
    else if (m_Entry.GetName() == "git")
    {
      const std::string admin_dir(FindEntry(filename).GetAdminDir());
      wd = GetTopLevelDir(admin_dir, filename);
      
      if (!filename.GetFullName().empty())
      {
        args = GetRelativeFile(
          admin_dir, 
          filename);
      }
    }
    else if (m_Entry.GetName() == "sccs")
    {
      args = "\"" + 
      // sccs for windows does not handle windows paths,
      // so convert them to UNIX, and add volume as well.
#ifdef __WXMSW__      
        filename.GetVolume() + wxFileName::GetVolumeSeparator() +
#endif        
        filename.GetFullPath(wxPATH_UNIX) + "\"";
    }
    else
    {
      args = "\"" + filename.GetFullPath() + "\"";
    }
    
    return m_Entry.Execute(args, filename.GetLexer(), true, wd);
  }
}
Пример #2
0
long wxExVCS::Execute()
{
  const wxExFileName filename(GetFile());

  if (!filename.IsOk())
  {
    wxString args;

    if (m_Entry.GetCommand().IsAdd())
    {
      args = wxExConfigFirstOf(_("Path"));
    }
    
    return m_Entry.Execute(
      args, 
      wxExLexer(), 
      wxExConfigFirstOf(_("Base folder")));
  }
  else
  {
    wxString args;
    wxString wd;
    
    if (m_Files.size() > 1)
    {
      // File should not be surrounded by double quotes.
      for (
#ifdef wxExUSE_CPP0X	
        auto it = m_Files.begin();
#else
        wxArrayString::iterator it = m_Files.begin();
#endif		
        it != m_Files.end();
        ++it)
      {
        args += *it + " ";
      }
    }
    else if (m_Entry.GetName().Lower() == "git")
    {
      const wxString admin_dir(FindEntry(filename).GetAdminDir());
      wd = GetTopLevelDir(admin_dir, filename);
      
      if (!filename.GetFullName().empty())
      {
        args = GetRelativeFile(
          admin_dir, 
          filename);
      }
    }
    else if (m_Entry.GetName().Lower() == "sccs")
    {
      args = "\"" + 
      // sccs for windows does not handle windows paths,
      // so convert them to UNIX, and add volume as well.
#ifdef __WXMSW__      
        filename.GetVolume() + filename.GetVolumeSeparator() +
#endif        
        filename.GetFullPath(wxPATH_UNIX) + "\"";
    }
    else
    {
      args = "\"" + filename.GetFullPath() + "\"";
    }
    
    return m_Entry.Execute(args, filename.GetLexer(), wd);
  }