Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
corpus2
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Analysers
corpus2
Commits
c9c06d39
Commit
c9c06d39
authored
14 years ago
by
ilor
Browse files
Options
Downloads
Patches
Plain Diff
add PathSearcher::list_files to find a list of files in the search path matching an extension
parent
5f30bdd8
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libpwrutils/pathsearch.cpp
+18
-0
18 additions, 0 deletions
libpwrutils/pathsearch.cpp
libpwrutils/pathsearch.h
+5
-0
5 additions, 0 deletions
libpwrutils/pathsearch.h
with
23 additions
and
0 deletions
libpwrutils/pathsearch.cpp
+
18
−
0
View file @
c9c06d39
...
...
@@ -100,6 +100,24 @@ bool PathSearcherBase::open_stream(const std::string& filename,
return
false
;
}
std
::
vector
<
std
::
string
>
PathSearcherBase
::
list_files
(
const
std
::
string
&
suffix
)
const
{
using
boost
::
filesystem
::
directory_iterator
;
std
::
vector
<
std
::
string
>
out
;
foreach
(
const
std
::
string
&
s
,
get_search_path
())
{
boost
::
filesystem
::
path
p
(
s
);
if
(
boost
::
filesystem
::
is_directory
(
s
))
{
for
(
directory_iterator
i
(
p
);
i
!=
directory_iterator
();
++
i
)
{
boost
::
filesystem
::
path
in
=
i
->
path
();
if
(
in
.
extension
()
==
suffix
)
{
out
.
push_back
(
in
.
stem
());
}
}
}
}
return
out
;
}
ConfigPathSetter
::
ConfigPathSetter
(
PathSearcherBase
&
ps
,
const
std
::
string
&
new_path
)
...
...
This diff is collapsed.
Click to expand it.
libpwrutils/pathsearch.h
+
5
−
0
View file @
c9c06d39
...
...
@@ -85,6 +85,11 @@ public:
bool
open_stream
(
const
std
::
string
&
filename
,
std
::
ifstream
&
ifs
,
const
std
::
string
&
info
=
""
);
/**
* Look for files matching a condition.
*/
std
::
vector
<
std
::
string
>
list_files
(
const
std
::
string
&
suffix
)
const
;
private
:
/// The search paths
std
::
vector
<
std
::
string
>
paths_
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment