static void setExceptionLocation(LLDBPlugin* plugin, PDWriter* writer) { char filename[2048]; memset(filename, 0, sizeof(filename)); // Get the filename & line of the exception/breakpoint // \todo: Right now we assume that we only got the break/exception at the first thread. lldb::SBThread thread(plugin->process.GetThreadByID(plugin->selectedThreadId)); uint32_t frameIndex = getThreadFrame(plugin, plugin->selectedThreadId); lldb::SBFrame frame(thread.GetFrameAtIndex(frameIndex)); lldb::SBCompileUnit compileUnit = frame.GetCompileUnit(); lldb::SBFileSpec filespec(plugin->process.GetTarget().GetExecutable()); if (compileUnit.GetNumSupportFiles() > 0) { lldb::SBFileSpec fileSpec = compileUnit.GetSupportFileAtIndex(0); fileSpec.GetPath(filename, sizeof(filename)); } lldb::SBSymbolContext context(frame.GetSymbolContext(lldb::eSymbolContextEverything)); lldb::SBLineEntry entry(context.GetLineEntry()); uint32_t line = entry.GetLine(); PDWrite_event_begin(writer, PDEventType_SetExceptionLocation); PDWrite_string(writer, "filename", filename); PDWrite_u32(writer, "line", line); PDWrite_event_end(writer); }
void SpellCheckerConfig::ScanForDictionaries(const wxString &path) { m_dictionaries.clear(); selectedDictionary = -1; //wxString filespec(_T("??_??.dic")); wxString filespec(_T("*.dic")); wxDir dir; if ( dir.Open(path) ) { wxString strfilename; bool cont = dir.GetFirst(&strfilename, filespec, wxDIR_FILES ); while ( cont ) { wxFileName fname(strfilename); wxString afffilename = path + wxFileName::GetPathSeparator() + fname.GetName() + _T(".aff"); if ( wxFileName::FileExists(afffilename) ) { if ( fname.GetName() == m_strDictionaryName ) selectedDictionary = m_dictionaries.size(); m_dictionaries.push_back(fname.GetName()); } cont = dir.GetNext(&strfilename); } } // disable online checker if there are no dictionaries found if (m_dictionaries.empty()) { m_EnableOnlineChecker = false; } }
static bbc_status_t remote_crc(serial_h com, bool wildcards, bool directories) { bbc_status_t result = BBC_OK ; char name[MAXLINELEN] ; if ( filespec(name, MAXLINELEN, wildcards, directories) == 0 ) return BBC_OK ; if ( wildcards ) { filelist *files ; if ( (result = getfilenames(com, name, &files, directories)) == BBC_SYNC ) { result = BBC_OK ; while ( files && !interrupted(true) ) { filelist *next = files->next ; if ( (result = retrieve_crc(com, files)) != BBC_OK ) { printf("Error retrieving CRC of %s, skipping\n", files->name) ; free(files) ; files = next ; break ; } free(files) ; files = next ; } while ( files ) { filelist *next = files->next ; printf("Skipping file %s because of previous error\n", files->name) ; free(files) ; files = next ; } } } else { filelist file ; strcpy(file.name, name) ; if ( (result = retrieve_crc(com, &file)) != BBC_OK ) printf("Error retrieving CRC for %s\n", name) ; } return result ; }
CFX_WideString CPDF_Action::GetFilePath() const { CFX_ByteString type = m_pDict->GetString("S"); if (type != "GoToR" && type != "Launch" && type != "SubmitForm" && type != "ImportData") { return CFX_WideString(); } CPDF_Object* pFile = m_pDict->GetElementValue("F"); CFX_WideString path; if (!pFile) { if (type == "Launch") { CPDF_Dictionary* pWinDict = m_pDict->GetDict("Win"); if (pWinDict) { return CFX_WideString::FromLocal(pWinDict->GetString("F")); } } return path; } CPDF_FileSpec filespec(pFile); filespec.GetFileName(path); return path; }
void ecRunTestsExecutablesDialog::OnAddFromFolder(wxCommandEvent& event) { wxCheckListBox* checkList = (wxCheckListBox*) FindWindow(ecID_RUN_TESTS_TEST_LIST); if (!checkList) return; // In the MFC tool, a modified version of the folder dialog was used but // we can't do that in general in wxWindows; so instead we ask the questions // before we show the folder dialog. // We won't bother allowing the user to change the extension: on Windows it's .exe, // on Unix it's anything. //#ifdef __WXMSW__ // wxString filespec(wxT("*.exe")); //#else wxString filespec(wxT("*")); //#endif wxString msg; msg.Printf(_("Would you like to add from subfolders, or just the folder you specify?\nChoose Yes to add from subfolders.")); int ans = wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_QUESTION|wxYES_NO|wxCANCEL, this); if (ans == wxCANCEL) return; bool recurse = (ans == wxYES); wxDirDialog dialog(this, _("Choose a folder to add tests from"), wxGetCwd()); if (dialog.ShowModal() == wxID_OK) { wxString folder(dialog.GetPath()); if (!wxDirExists(folder)) { wxMessageBox(_("Sorry, this folder does not exist."), wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK, this); return; } wxBusyCursor busy; AddFromFolder(folder, recurse, filespec); } }
void SpellCheckerConfig::ScanForDictionaries(const wxString &path) { m_dictionaries.clear(); selectedDictionary = wxNOT_FOUND; //wxString filespec(_T("??_??.dic")); wxString filespec(_T("*.dic")); wxDir dir; if ( dir.Open(path) ) { wxString strfilename; bool cont = dir.GetFirst(&strfilename, filespec, wxDIR_FILES); while ( cont ) { wxFileName fname(strfilename); wxString afffilename = path + wxFileName::GetPathSeparator() + fname.GetName() + _T(".aff"); if ( wxFileName::FileExists(afffilename) ) { if ( fname.GetName() == m_strDictionaryName ) { Manager::Get()->GetLogManager()->DebugLog(_T("Selected dictionary: ") + fname.GetName()); selectedDictionary = m_dictionaries.size(); } Manager::Get()->GetLogManager()->DebugLog(_T("Found dictionary: ") + fname.GetName()); m_dictionaries.push_back(fname.GetName()); } cont = dir.GetNext(&strfilename); } } else Manager::Get()->GetLogManager()->DebugLog(_T("Could not open path to dictionaries: ") + path); // disable online checker if there are no dictionaries found if (selectedDictionary == wxNOT_FOUND) { m_EnableOnlineChecker = false; } }
std::unique_ptr<CFDF_Document> CPDF_InterForm::ExportToFDF( const CFX_WideStringC& pdf_path, const std::vector<CPDF_FormField*>& fields, bool bIncludeOrExclude, bool bSimpleFileSpec) const { std::unique_ptr<CFDF_Document> pDoc = CFDF_Document::CreateNewDoc(); if (!pDoc) return nullptr; CPDF_Dictionary* pMainDict = pDoc->GetRoot()->GetDictFor("FDF"); if (!pdf_path.IsEmpty()) { if (bSimpleFileSpec) { CFX_WideString wsFilePath = CPDF_FileSpec::EncodeFileName(pdf_path); pMainDict->SetNewFor<CPDF_String>( "F", CFX_ByteString::FromUnicode(wsFilePath), false); pMainDict->SetNewFor<CPDF_String>("UF", PDF_EncodeText(wsFilePath), false); } else { CPDF_FileSpec filespec(pDoc->GetByteStringPool()); filespec.SetFileName(pdf_path); pMainDict->SetFor("F", pdfium::WrapUnique(filespec.GetObj())); } } CPDF_Array* pFields = pMainDict->SetNewFor<CPDF_Array>("Fields"); size_t nCount = m_pFieldTree->m_Root.CountFields(); for (size_t i = 0; i < nCount; ++i) { CPDF_FormField* pField = m_pFieldTree->m_Root.GetFieldAtIndex(i); if (!pField || pField->GetType() == CPDF_FormField::PushButton) continue; uint32_t dwFlags = pField->GetFieldFlags(); if (dwFlags & 0x04) continue; if (bIncludeOrExclude == pdfium::ContainsValue(fields, pField)) { if ((dwFlags & 0x02) != 0 && pField->m_pDict->GetStringFor("V").IsEmpty()) continue; CFX_WideString fullname = FPDF_GetFullName(pField->GetFieldDict()); auto pFieldDict = pdfium::MakeUnique<CPDF_Dictionary>(pDoc->GetByteStringPool()); pFieldDict->SetNewFor<CPDF_String>("T", fullname); if (pField->GetType() == CPDF_FormField::CheckBox || pField->GetType() == CPDF_FormField::RadioButton) { CFX_WideString csExport = pField->GetCheckValue(false); CFX_ByteString csBExport = PDF_EncodeText(csExport); CPDF_Object* pOpt = FPDF_GetFieldAttr(pField->m_pDict, "Opt"); if (pOpt) pFieldDict->SetNewFor<CPDF_String>("V", csBExport, false); else pFieldDict->SetNewFor<CPDF_Name>("V", csBExport); } else { CPDF_Object* pV = FPDF_GetFieldAttr(pField->m_pDict, "V"); if (pV) pFieldDict->SetFor("V", pV->CloneDirectObject()); } pFields->Add(std::move(pFieldDict)); } } return pDoc; }