Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Karsten Rink
ogs
Commits
494b9d20
Commit
494b9d20
authored
Nov 27, 2020
by
Karsten Rink
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[baselib] moved file removal to baselib
parent
69cca7f8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
18 deletions
+18
-18
Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp
Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp
+4
-13
BaseLib/FileTools.cpp
BaseLib/FileTools.cpp
+10
-5
BaseLib/FileTools.h
BaseLib/FileTools.h
+4
-0
No files found.
Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp
View file @
494b9d20
...
...
@@ -43,16 +43,6 @@
#include <QApplication>
/// deletes temporary output files
void
removeFile
(
std
::
string
const
&
filename
)
{
std
::
string
remove_cmd
(
"rm "
+
filename
);
#ifdef _WIN32
remove_cmd
=
"del "
+
filename
;
#endif
system
(
remove_cmd
.
c_str
());
}
/// reads the list of mesh files into a string vector
std
::
vector
<
std
::
string
>
readLayerFile
(
std
::
string
const
&
layer_file
)
{
...
...
@@ -239,7 +229,8 @@ void consolidateGeometry(GeoLib::GEOObjects& geo,
if
(
!
keep_gml_file
)
{
removeFile
(
filename
);
BaseLib
::
removeFile
(
filename
);
BaseLib
::
removeFile
(
filename
+
".md5"
);
}
}
...
...
@@ -398,8 +389,8 @@ int main(int argc, char* argv[])
generateMesh
(
geo
,
merged_geo_name
,
output_name
,
interval_length
));
if
(
!
test_arg
.
getValue
())
{
removeFile
(
output_name
+
".geo"
);
removeFile
(
output_name
+
".msh"
);
BaseLib
::
removeFile
(
output_name
+
".geo"
);
BaseLib
::
removeFile
(
output_name
+
".msh"
);
}
if
(
mesh
==
nullptr
)
{
...
...
BaseLib/FileTools.cpp
View file @
494b9d20
...
...
@@ -229,15 +229,20 @@ void setProjectDirectory(std::string const& dir)
project_directory_is_set
=
true
;
}
void
removeFile
(
std
::
string
const
&
filename
)
{
bool
const
success
=
fs
::
remove
(
fs
::
path
(
filename
));
if
(
success
)
{
DBUG
(
"Removed '{:s}'"
,
filename
);
}
}
void
removeFiles
(
std
::
vector
<
std
::
string
>
const
&
files
)
{
for
(
auto
const
&
file
:
files
)
{
bool
const
success
=
fs
::
remove
(
fs
::
path
(
file
));
if
(
success
)
{
DBUG
(
"Removed '{:s}'"
,
file
);
}
removeFile
(
file
);
}
}
}
// end namespace BaseLib
BaseLib/FileTools.h
View file @
494b9d20
...
...
@@ -184,6 +184,10 @@ std::string const& getProjectDirectory();
/// Sets the project directory.
void
setProjectDirectory
(
std
::
string
const
&
dir
);
/// Removes a file. If a file does not exist nothing will happen, other errors
/// lead to OGS_FATAL call.
void
removeFile
(
std
::
string
const
&
filename
);
/// Remove files. If a file does not exist nothing will happen, other errors
/// lead to OGS_FATAL call.
void
removeFiles
(
std
::
vector
<
std
::
string
>
const
&
files
);
...
...
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