We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b070ae3 commit 68becb4Copy full SHA for 68becb4
src/FileUtils.cxx
@@ -136,14 +136,19 @@ namespace TiCC {
136
137
void erase( const string& name ){
138
/// remove a file
139
- try {
+ if ( isFile( name ) ){
140
filesystem::path p(name);
141
- filesystem::remove( p );
+ try {
142
+ filesystem::remove( p );
143
+ }
144
+ catch ( const exception& e ){
145
+ // error OR file doesn't exist
146
+ throw runtime_error( "could not erase file/path '" + name + "': "
147
+ + e.what() );
148
149
}
- catch ( const exception& e ){
- // error OR file doesn't exist
- throw runtime_error( "could not erase file/path '" + name + "': "
- + e.what() );
150
+ else {
151
+ throw runtime_error( "could not erase file/path '" + name + "'" );
152
153
154
0 commit comments