Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
23c74af8
Commit
23c74af8
authored
Apr 03, 2022
by
Adrià Arrufat
Committed by
Davis E. King
Apr 06, 2022
Browse files
Add directory_exists
parent
9bb1b6f7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
4 deletions
+43
-4
dlib/dir_nav/dir_nav_extensions.cpp
dlib/dir_nav/dir_nav_extensions.cpp
+18
-4
dlib/dir_nav/dir_nav_extensions.h
dlib/dir_nav/dir_nav_extensions.h
+6
-0
dlib/dir_nav/dir_nav_extensions_abstract.h
dlib/dir_nav/dir_nav_extensions_abstract.h
+13
-0
docs/docs/api.xml
docs/docs/api.xml
+4
-0
docs/docs/release_notes.xml
docs/docs/release_notes.xml
+1
-0
docs/docs/term_index.xml
docs/docs/term_index.xml
+1
-0
No files found.
dlib/dir_nav/dir_nav_extensions.cpp
View file @
23c74af8
...
@@ -51,6 +51,23 @@ namespace dlib
...
@@ -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
(
directory
get_parent_directory
(
...
@@ -70,7 +87,7 @@ namespace dlib
...
@@ -70,7 +87,7 @@ namespace dlib
return
directory
();
return
directory
();
std
::
string
::
size_type
pos
=
f
.
full_name
().
find_last_of
(
"
\\
/"
);
std
::
string
::
size_type
pos
=
f
.
full_name
().
find_last_of
(
"
\\
/"
);
if
(
pos
==
std
::
string
::
npos
)
if
(
pos
==
std
::
string
::
npos
)
return
directory
();
return
directory
();
...
@@ -116,6 +133,3 @@ namespace dlib
...
@@ -116,6 +133,3 @@ namespace dlib
}
}
#endif // DLIB_DIR_NAV_EXTENSIONs_CPP_
#endif // DLIB_DIR_NAV_EXTENSIONs_CPP_
dlib/dir_nav/dir_nav_extensions.h
View file @
23c74af8
...
@@ -19,6 +19,12 @@ namespace dlib
...
@@ -19,6 +19,12 @@ namespace dlib
const
std
::
string
&
filename
const
std
::
string
&
filename
);
);
// ----------------------------------------------------------------------------------------
bool
directory_exists
(
const
std
::
string
&
dirname
);
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
namespace
implementation_details
namespace
implementation_details
...
...
dlib/dir_nav/dir_nav_extensions_abstract.h
View file @
23c74af8
...
@@ -23,6 +23,19 @@ namespace dlib
...
@@ -23,6 +23,19 @@ namespace dlib
- returns false
- 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
>
template
<
typename
T
>
...
...
docs/docs/api.xml
View file @
23c74af8
...
@@ -595,6 +595,10 @@
...
@@ -595,6 +595,10 @@
<name>
file_exists
</name>
<name>
file_exists
</name>
<link>
dlib/dir_nav/dir_nav_extensions_abstract.h.html#file_exists
</link>
<link>
dlib/dir_nav/dir_nav_extensions_abstract.h.html#file_exists
</link>
</item>
</item>
<item>
<name>
directory_exists
</name>
<link>
dlib/dir_nav/dir_nav_extensions_abstract.h.html#directory_exists
</link>
</item>
<item>
<item>
<name>
select_oldest_file
</name>
<name>
select_oldest_file
</name>
<link>
dlib/dir_nav/dir_nav_extensions_abstract.h.html#select_oldest_file
</link>
<link>
dlib/dir_nav/dir_nav_extensions_abstract.h.html#select_oldest_file
</link>
...
...
docs/docs/release_notes.xml
View file @
23c74af8
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
<current>
<current>
New Features and Improvements:
New Features and Improvements:
- Added Beta distribution to dlib::rand.
- Added Beta distribution to dlib::rand.
- Added directory_exists.
- Deep learning tooling:
- Deep learning tooling:
- Added ReOrg layer.
- Added ReOrg layer.
- Added visitor to draw network architectures using the DOT language.
- Added visitor to draw network architectures using the DOT language.
...
...
docs/docs/term_index.xml
View file @
23c74af8
...
@@ -1094,6 +1094,7 @@
...
@@ -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_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=
"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=
"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_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=
"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"
/>
<term
file=
"dlib/dir_nav/dir_nav_extensions_abstract.h.html"
name=
"match_ending"
include=
"dlib/dir_nav.h"
/>
...
...
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