Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
b52e50a3
Commit
b52e50a3
authored
Jul 02, 2015
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a .revert() to the locally_change_current_dir object.
parent
48444811
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
misc_api_kernel_abstract.h
dlib/misc_api/misc_api_kernel_abstract.h
+10
-1
misc_api_shared.h
dlib/misc_api/misc_api_shared.h
+13
-1
No files found.
dlib/misc_api/misc_api_kernel_abstract.h
View file @
b52e50a3
...
...
@@ -90,7 +90,16 @@ namespace dlib
);
/*!
ensures
- calls set_current_dir(old_dir())
- if (revert() hasn't already been called) then
- calls set_current_dir(old_dir())
!*/
void
revert
(
);
/*!
ensures
- if (revert() hasn't already been called) then
- calls set_current_dir(old_dir())
!*/
};
...
...
dlib/misc_api/misc_api_shared.h
View file @
b52e50a3
...
...
@@ -18,13 +18,14 @@ namespace dlib
const
std
::
string
&
new_dir
)
{
reverted
=
false
;
_old_dir
=
get_current_dir
();
set_current_dir
(
new_dir
);
}
~
locally_change_current_dir
()
{
set_current_dir
(
_old_dir
);
revert
(
);
}
const
std
::
string
&
old_dir
(
...
...
@@ -33,7 +34,18 @@ namespace dlib
return
_old_dir
;
}
void
revert
(
)
{
if
(
!
reverted
)
{
set_current_dir
(
_old_dir
);
reverted
=
true
;
}
}
private
:
bool
reverted
;
std
::
string
_old_dir
;
};
...
...
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