Debian Codegraph @

codelite-cli/csParsePHPFolderHandler.cpp

raw
1 #include "PHPLookupTable.h"
2 #include "csParsePHPFolderHandler.h"
3 #include <wx/filename.h>
4
5 csParsePHPFolderHandler::csParsePHPFolderHandler(csManager* manager)
6 : csCommandHandlerBase(manager)
7 {
8 }
9
10 csParsePHPFolderHandler::~csParsePHPFolderHandler() {}
11
12 void csParsePHPFolderHandler::DoProcessCommand(const JSONItem& options)
13 {
14 CHECK_STR_PARAM("path", m_folder);
15 CHECK_STR_PARAM("mask", m_mask);
16 CHECK_STR_PARAM_OPTIONAL("symbols-path", m_dbpath);
17
18 PHPLookupTable lookup;
19 // Build the default symbols db path
20 wxFileName dbpath(m_folder, "phpsymbols.db");
21 dbpath.AppendDir(".codelite");
22
23 // Allow the user to override
24 if(!m_dbpath.IsEmpty()) {
25 wxFileName userPath(m_dbpath);
26 userPath.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
27 m_dbpath = userPath.GetFullPath();
28 dbpath = m_dbpath;
29 }
30
31 clDEBUG() << "Using symbols db:" << dbpath;
32 lookup.Open(dbpath);
33 if(!lookup.IsOpened()) {
34 clERROR() << "Could not open file:" << dbpath;
35 return;
36 }
37 // Clear any content before we start the parsing
38 lookup.ParseFolder(m_folder, m_mask, PHPLookupTable::kUpdateMode_Fast);
39 }