Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
iMSTK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ruiliang Gao
iMSTK
Commits
508eab36
Commit
508eab36
authored
8 years ago
by
Alexis Girault
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Implement fileExists in reader
Check if file exists in imstkMeshReader.
parent
e8e8b047
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Base/Geometry/Reader/imstkMeshReader.cpp
+12
-2
12 additions, 2 deletions
Base/Geometry/Reader/imstkMeshReader.cpp
Base/Geometry/Reader/imstkMeshReader.h
+6
-1
6 additions, 1 deletion
Base/Geometry/Reader/imstkMeshReader.h
with
18 additions
and
3 deletions
Base/Geometry/Reader/imstkMeshReader.cpp
+
12
−
2
View file @
508eab36
...
...
@@ -21,6 +21,8 @@
#include
"imstkMeshReader.h"
#include
<sys/stat.h>
#include
"imstkVTKMeshReader.h"
#include
"imstkVegaMeshReader.h"
...
...
@@ -30,12 +32,13 @@ namespace imstk {
std
::
shared_ptr
<
Mesh
>
MeshReader
::
read
(
const
std
::
string
&
filePath
)
{
FileType
meshType
=
MeshReader
::
getFileType
(
filePath
);
if
(
meshType
==
FileType
::
UNKNOWN
)
if
(
!
MeshReader
::
fileExists
(
filePath
))
{
LOG
(
WARNING
)
<<
"MeshReader::read error: file not found: "
<<
filePath
;
return
nullptr
;
}
FileType
meshType
=
MeshReader
::
getFileType
(
filePath
);
switch
(
meshType
)
{
case
FileType
::
VTK
:
...
...
@@ -55,6 +58,13 @@ MeshReader::read(const std::string& filePath)
return
nullptr
;
}
bool
MeshReader
::
fileExists
(
const
std
::
string
&
file
)
{
struct
stat
buf
;
return
(
stat
(
file
.
c_str
(),
&
buf
)
==
0
);
}
const
MeshReader
::
FileType
MeshReader
::
getFileType
(
const
std
::
string
&
filePath
)
{
...
...
This diff is collapsed.
Click to expand it.
Base/Geometry/Reader/imstkMeshReader.h
+
6
−
1
View file @
508eab36
...
...
@@ -55,10 +55,15 @@ public:
~
MeshReader
()
=
default
;
///
/// \brief
/// \brief
read
///
static
std
::
shared_ptr
<
Mesh
>
read
(
const
std
::
string
&
filePath
);
///
/// \brief fileExists
///
static
bool
fileExists
(
const
std
::
string
&
file
);
protected
:
static
const
FileType
getFileType
(
const
std
::
string
&
filePath
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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