Subversion Repositories tpanel

Rev

Rev 326 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 326 Rev 339
Line 195... Line 195...
195
 
195
 
196
	done = false;
196
	done = false;
197
	return readDir();
197
	return readDir();
198
}
198
}
199
 
199
 
200
int TDirectory::scanFiles(const string &filter)
200
int TDirectory::scanFiles(const string &filter, bool start)
201
{
201
{
202
    DECL_TRACER("TDirectory::scanFiles(const string &filter)");
202
    DECL_TRACER("TDirectory::scanFiles(const string &filter, bool start)");
203
 
203
 
204
    if (path.empty())
204
    if (path.empty())
205
        return 0;
205
        return 0;
206
 
206
 
207
    int count = 0;
207
    int count = 0;
Line 215... Line 215...
215
            string f = fs::path(p.path()).filename();
215
            string f = fs::path(p.path()).filename();
216
 
216
 
217
            if (checkDot(f))
217
            if (checkDot(f))
218
                continue;
218
                continue;
219
 
219
 
-
 
220
            size_t pos;
-
 
221
 
220
            if (!filter.empty() && f.find(filter) == string::npos)
222
            if (!filter.empty() && (pos = f.find(filter)) == string::npos)
-
 
223
                continue;
-
 
224
 
-
 
225
            if (start && pos != 0)
221
                continue;
226
                continue;
222
 
227
 
223
            count++;
228
            count++;
224
            dr.count = count;
229
            dr.count = count;
225
#if __GNUC__ < 9
230
#if __GNUC__ < 9
Line 502... Line 507...
502
    for (iter = entries.begin(); iter != entries.end(); ++iter)
507
    for (iter = entries.begin(); iter != entries.end(); ++iter)
503
    {
508
    {
504
        if ((pos = iter->name.find(part)) != string::npos)
509
        if ((pos = iter->name.find(part)) != string::npos)
505
        {
510
        {
506
            char next = iter->name.at(pos + part.length());
511
            char next = iter->name.at(pos + part.length());
-
 
512
            char prev = (pos > 0 ? iter->name.at(pos - 1) : 0);
507
 
513
 
508
            if (next == '.')
514
            if (next == '.')
509
                return iter->name;
515
                return iter->name;
510
 
516
 
511
            if (precice && next == '_')
517
            if (precice && (next == '_' || prev != 0))
512
                continue;
518
                continue;
513
 
519
 
514
            if ((next >= 'A' && next <= 'Z') || (next >= 'a' && next <= 'z'))
520
            if ((next >= 'A' && next <= 'Z') || (next >= 'a' && next <= 'z'))
515
                continue;
521
                continue;
516
 
522
 
Line 519... Line 525...
519
    }
525
    }
520
 
526
 
521
    return string();
527
    return string();
522
}
528
}
523
 
529
 
-
 
530
string TDirectory::getEntryWithStart(const string& start)
-
 
531
{
-
 
532
    DECL_TRACER("TDirectory::getEntryWithStart(const string& start)");
-
 
533
 
-
 
534
    if (start.empty())
-
 
535
        return string();
-
 
536
 
-
 
537
    MSG_DEBUG("Searching for \"" << start << "\"");
-
 
538
 
-
 
539
    vector<DFILES_T>::iterator iter;
-
 
540
 
-
 
541
    for (iter = entries.begin(); iter != entries.end(); ++iter)
-
 
542
    {
-
 
543
        if (startsWith(iter->name, start))
-
 
544
            return iter->name;
-
 
545
    }
-
 
546
 
-
 
547
    return string();
-
 
548
}
-
 
549
 
524
size_t TDirectory::getFileSize (const string &f)
550
size_t TDirectory::getFileSize (const string &f)
525
{
551
{
526
	DECL_TRACER("Directory::getFileSize (const string &f)");
552
	DECL_TRACER("Directory::getFileSize (const string &f)");
527
	size_t s = 0;
553
	size_t s = 0;
528
 
554