Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
vidjil
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1,701
Issues
1,701
List
Boards
Labels
Service Desk
Milestones
Merge Requests
92
Merge Requests
92
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vidjil
vidjil
Commits
d84d1e50
Commit
d84d1e50
authored
Jul 16, 2015
by
Mathieu Giraud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/tools.{cpp,h}: extract_dirname
parent
d07b875a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
algo/core/tools.cpp
algo/core/tools.cpp
+10
-0
algo/core/tools.h
algo/core/tools.h
+6
-1
No files found.
algo/core/tools.cpp
View file @
d84d1e50
...
...
@@ -178,6 +178,16 @@ string extract_from_label(string str, int field, string separator)
return
str
.
substr
(
found1
+
1
,
found2
-
found1
-
1
);
}
string
extract_dirname
(
string
path
)
{
size_t
pos_lastdir
=
path
.
find_last_of
(
'/'
);
if
(
pos_lastdir
!=
std
::
string
::
npos
)
{
path
=
path
.
substr
(
0
,
pos_lastdir
);
}
return
path
;
}
string
extract_basename
(
string
path
,
bool
remove_ext
)
{
size_t
pos_lastdir
=
path
.
find_last_of
(
'/'
);
if
(
pos_lastdir
!=
std
::
string
::
npos
)
{
...
...
algo/core/tools.h
View file @
d84d1e50
...
...
@@ -120,7 +120,12 @@ int dna_to_int(const string &, int size);
string
extract_from_label
(
string
str
,
int
field
,
string
separator
);
/**
* @return Extract basename of a file and extracts extension (by default
* @return Extract dirname of a file
*/
string
extract_dirname
(
string
path
);
/**
* @return Extract basename of a file and extracts extension (by default)
*/
string
extract_basename
(
string
path
,
bool
remove_ext
=
true
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment