mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Add directory_exists
This commit is contained in:
parent
9bb1b6f712
commit
23c74af872
@ -51,6 +51,23 @@ namespace dlib
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
bool directory_exists (
|
||||
const std::string& dirname
|
||||
)
|
||||
{
|
||||
try
|
||||
{
|
||||
dlib::directory temp(dirname);
|
||||
return true;
|
||||
}
|
||||
catch (directory::dir_not_found&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
directory get_parent_directory (
|
||||
@ -116,6 +133,3 @@ namespace dlib
|
||||
}
|
||||
|
||||
#endif // DLIB_DIR_NAV_EXTENSIONs_CPP_
|
||||
|
||||
|
||||
|
||||
|
@ -19,6 +19,12 @@ namespace dlib
|
||||
const std::string& filename
|
||||
);
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
bool directory_exists (
|
||||
const std::string& dirname
|
||||
);
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
namespace implementation_details
|
||||
|
@ -23,6 +23,19 @@ namespace dlib
|
||||
- returns false
|
||||
!*/
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
bool directory_exists (
|
||||
const std::string& dirname
|
||||
);
|
||||
/*!
|
||||
ensures
|
||||
- if (a directory with the given filename exists) then
|
||||
- returns true
|
||||
- else
|
||||
- returns false
|
||||
!*/
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
template <typename T>
|
||||
|
@ -595,6 +595,10 @@
|
||||
<name>file_exists</name>
|
||||
<link>dlib/dir_nav/dir_nav_extensions_abstract.h.html#file_exists</link>
|
||||
</item>
|
||||
<item>
|
||||
<name>directory_exists</name>
|
||||
<link>dlib/dir_nav/dir_nav_extensions_abstract.h.html#directory_exists</link>
|
||||
</item>
|
||||
<item>
|
||||
<name>select_oldest_file</name>
|
||||
<link>dlib/dir_nav/dir_nav_extensions_abstract.h.html#select_oldest_file</link>
|
||||
|
@ -13,6 +13,7 @@
|
||||
<current>
|
||||
New Features and Improvements:
|
||||
- Added Beta distribution to dlib::rand.
|
||||
- Added directory_exists.
|
||||
- Deep learning tooling:
|
||||
- Added ReOrg layer.
|
||||
- Added visitor to draw network architectures using the DOT language.
|
||||
|
@ -1094,6 +1094,7 @@
|
||||
<term file="dlib/dir_nav/dir_nav_extensions_abstract.h.html" name="get_files_in_directory_tree" include="dlib/dir_nav.h"/>
|
||||
<term file="dlib/dir_nav/dir_nav_extensions_abstract.h.html" name="get_parent_directory" include="dlib/dir_nav.h"/>
|
||||
<term file="dlib/dir_nav/dir_nav_extensions_abstract.h.html" name="file_exists" include="dlib/dir_nav.h"/>
|
||||
<term file="dlib/dir_nav/dir_nav_extensions_abstract.h.html" name="directory_exists" include="dlib/dir_nav.h"/>
|
||||
<term file="dlib/dir_nav/dir_nav_extensions_abstract.h.html" name="select_oldest_file" include="dlib/dir_nav.h"/>
|
||||
<term file="dlib/dir_nav/dir_nav_extensions_abstract.h.html" name="select_newest_file" include="dlib/dir_nav.h"/>
|
||||
<term file="dlib/dir_nav/dir_nav_extensions_abstract.h.html" name="match_ending" include="dlib/dir_nav.h"/>
|
||||
|
Loading…
Reference in New Issue
Block a user