Skip to content
This repository has been archived by the owner on Feb 14, 2024. It is now read-only.

Commit

Permalink
Don't fail update from sources if just some dirs are missing.
Browse files Browse the repository at this point in the history
  • Loading branch information
vslavik committed Sep 12, 2012
1 parent d33de0d commit f17bc68
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
24 changes: 11 additions & 13 deletions src/digger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,16 @@ bool SourceDigger::DigFiles(TempDirectory& tmpdir,
wxArrayString *SourceDigger::FindFiles(const wxArrayString& paths,
ParsersDB& pdb)
{
if (pdb.GetCount() == 0) return NULL;
if (pdb.GetCount() == 0)
return NULL;
wxArrayString *p_files = new wxArrayString[pdb.GetCount()];
wxArrayString files;
size_t i;

for (i = 0; i < paths.GetCount(); i++)
if (!FindInDir(paths[i], files))
{
delete[] p_files;
return NULL;
if ( !FindInDir(paths[i], files) )
wxLogWarning(_("No files found in: ") + paths[i]);
}

size_t filescnt = 0;
Expand All @@ -194,39 +194,37 @@ wxArrayString *SourceDigger::FindFiles(const wxArrayString& paths,
m_progressInfo->SetGaugeMax(filescnt);

if (filescnt == 0)
{
for (i = 0; i < paths.GetCount(); i++)
wxLogWarning(_("No files found in: ") + paths[i]);
wxLogError(_("Poedit did not find any files in scanned directories."));
}

return p_files;
}



bool SourceDigger::FindInDir(const wxString& dirname, wxArrayString& files)
int SourceDigger::FindInDir(const wxString& dirname, wxArrayString& files)
{
wxDir dir(dirname);
if (!dir.IsOpened())
return false;
return 0;
bool cont;
wxString filename;
int found = 0;

cont = dir.GetFirst(&filename, wxEmptyString, wxDIR_FILES);
while (cont)
{
files.Add(dirname + _T("/") + filename);
found++;
cont = dir.GetNext(&filename);
}

cont = dir.GetFirst(&filename, wxEmptyString, wxDIR_DIRS);
while (cont)
{
if (!FindInDir(dirname + _T("/") + filename, files))
return false;
found += FindInDir(dirname + _T("/") + filename, files);
cont = dir.GetNext(&filename);
}
return true;

return found;
}

2 changes: 1 addition & 1 deletion src/digger.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class SourceDigger
/** Finds all files in given directory.
\return false if an error occured.
*/
bool FindInDir(const wxString& dirname, wxArrayString& files);
int FindInDir(const wxString& dirname, wxArrayString& files);

/** Digs translatable strings from given files.
\param outfiles list to which (temporary) file name of extracted
Expand Down

0 comments on commit f17bc68

Please sign in to comment.