Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Yuhao Liu
ogs
Commits
bca8bd0c
Commit
bca8bd0c
authored
4 years ago
by
Karsten Rink
Committed by
Lars Bilke
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[baselib] moved file removal to baselib
parent
5a9db31a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp
+4
-13
4 additions, 13 deletions
Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp
BaseLib/FileTools.cpp
+10
-5
10 additions, 5 deletions
BaseLib/FileTools.cpp
BaseLib/FileTools.h
+4
-0
4 additions, 0 deletions
BaseLib/FileTools.h
with
18 additions
and
18 deletions
Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp
+
4
−
13
View file @
bca8bd0c
...
@@ -43,16 +43,6 @@
...
@@ -43,16 +43,6 @@
#include
<QApplication>
#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
/// reads the list of mesh files into a string vector
std
::
vector
<
std
::
string
>
readLayerFile
(
std
::
string
const
&
layer_file
)
std
::
vector
<
std
::
string
>
readLayerFile
(
std
::
string
const
&
layer_file
)
{
{
...
@@ -239,7 +229,8 @@ void consolidateGeometry(GeoLib::GEOObjects& geo,
...
@@ -239,7 +229,8 @@ void consolidateGeometry(GeoLib::GEOObjects& geo,
if
(
!
keep_gml_file
)
if
(
!
keep_gml_file
)
{
{
removeFile
(
filename
);
BaseLib
::
removeFile
(
filename
);
BaseLib
::
removeFile
(
filename
+
".md5"
);
}
}
}
}
...
@@ -398,8 +389,8 @@ int main(int argc, char* argv[])
...
@@ -398,8 +389,8 @@ int main(int argc, char* argv[])
generateMesh
(
geo
,
merged_geo_name
,
output_name
,
interval_length
));
generateMesh
(
geo
,
merged_geo_name
,
output_name
,
interval_length
));
if
(
!
test_arg
.
getValue
())
if
(
!
test_arg
.
getValue
())
{
{
removeFile
(
output_name
+
".geo"
);
BaseLib
::
removeFile
(
output_name
+
".geo"
);
removeFile
(
output_name
+
".msh"
);
BaseLib
::
removeFile
(
output_name
+
".msh"
);
}
}
if
(
mesh
==
nullptr
)
if
(
mesh
==
nullptr
)
{
{
...
...
This diff is collapsed.
Click to expand it.
BaseLib/FileTools.cpp
+
10
−
5
View file @
bca8bd0c
...
@@ -226,15 +226,20 @@ void setProjectDirectory(std::string const& dir)
...
@@ -226,15 +226,20 @@ void setProjectDirectory(std::string const& dir)
project_directory_is_set
=
true
;
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
)
void
removeFiles
(
std
::
vector
<
std
::
string
>
const
&
files
)
{
{
for
(
auto
const
&
file
:
files
)
for
(
auto
const
&
file
:
files
)
{
{
bool
const
success
=
fs
::
remove
(
fs
::
path
(
file
));
removeFile
(
file
);
if
(
success
)
{
DBUG
(
"Removed '{:s}'"
,
file
);
}
}
}
}
}
}
// end namespace BaseLib
}
// end namespace BaseLib
This diff is collapsed.
Click to expand it.
BaseLib/FileTools.h
+
4
−
0
View file @
bca8bd0c
...
@@ -183,6 +183,10 @@ std::string const& getProjectDirectory();
...
@@ -183,6 +183,10 @@ std::string const& getProjectDirectory();
/// Sets the project directory.
/// Sets the project directory.
void
setProjectDirectory
(
std
::
string
const
&
dir
);
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
/// Remove files. If a file does not exist nothing will happen, other errors
/// lead to OGS_FATAL call.
/// lead to OGS_FATAL call.
void
removeFiles
(
std
::
vector
<
std
::
string
>
const
&
files
);
void
removeFiles
(
std
::
vector
<
std
::
string
>
const
&
files
);
...
...
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