Mailinglist Archive: limal-commit (24 mails)

< Previous Next >
[limal-commit] r2351 - /limal-head/limal/src/PathUtils.cpp
  • From: mcalmer@xxxxxxxxxxxxxxxx
  • Date: Fri, 12 Oct 2007 15:54:30 -0000
  • Message-id: <20071012155431.22E8E4553F@xxxxxxxxxxxxxxxx>
Author: mcalmer
Date: Fri Oct 12 17:54:30 2007
New Revision: 2351

URL: http://svn.opensuse.org/viewcvs/limal?rev=2351&view=rev
Log:
- remove a non existing file is not an error
- beautify error messages

Modified:
    limal-head/limal/src/PathUtils.cpp

Modified: limal-head/limal/src/PathUtils.cpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-head/limal/src/PathUtils.cpp?rev=2351&r1=2350&r2=2351&view=diff
==============================================================================
--- limal-head/limal/src/PathUtils.cpp (original)
+++ limal-head/limal/src/PathUtils.cpp Fri Oct 12 17:54:30 2007
@@ -167,7 +167,7 @@
             status = ps.exitStatus();
     }
     catch(const blocxx::Exception &e) {
-        LOGIT_ERROR( "removeDirRecursive exception:" << e);
+        LOGIT_ERROR( "removeDirRecursive exception: " << e);
     }
 #else
     try {
@@ -179,17 +179,17 @@
             status = WEXITSTATUS(execStatus);
     }
     catch(const blocxx::Exception &e) {
-        LOGIT_ERROR( "removeDirRecursive exception:" << e);
+        LOGIT_ERROR( "removeDirRecursive exception: " << e);
     }
 #endif
     if(status != 0) {
-        LOGIT_ERROR( "removeDirRecursive status:" << status );
+        LOGIT_ERROR( "removeDirRecursive status: " << status );
     }
     if(!errOutput.empty()) {
-        LOGIT_ERROR( "removeDirRecursive stderr:" << errOutput );
+        LOGIT_ERROR( "removeDirRecursive stderr: " << errOutput );
     }
     if(!stdOutput.empty()) {
-        LOGIT_DEBUG( "removeDirRecursive stdout:" << stdOutput );
+        LOGIT_DEBUG( "removeDirRecursive stdout: " << stdOutput );
     }
 
     return status;
@@ -242,7 +242,7 @@
             status = ps.exitStatus();
     }
     catch(const blocxx::Exception &e) {
-        LOGIT_ERROR( "copyDir exception:" << e);
+        LOGIT_ERROR( "copyDir exception: " << e);
     }
 #else
     try {
@@ -254,17 +254,17 @@
             status = WEXITSTATUS(execStatus);
     }
     catch(const blocxx::Exception &e) {
-        LOGIT_ERROR( "copyDir exception:" << e);
+        LOGIT_ERROR( "copyDir exception: " << e);
     }
 #endif
     if(status != 0) {
-        LOGIT_ERROR( "copyDir status:" << status );
+        LOGIT_ERROR( "copyDir status: " << status );
     }
     if(!errOutput.empty()) {
-        LOGIT_ERROR( "copyDir stderr:" << errOutput );
+        LOGIT_ERROR( "copyDir stderr: " << errOutput );
     }
     if(!stdOutput.empty()) {
-        LOGIT_DEBUG( "copyDir stdout:" << stdOutput );
+        LOGIT_DEBUG( "copyDir stdout: " << stdOutput );
     }
 
     return status;
@@ -287,7 +287,7 @@
 
     DIR * dir = ::opendir( path.toString().c_str() );
     if ( ! dir ) {
-        LOGIT_ERROR("readDir ::opendir returned" << errno2String(errno));
+        LOGIT_ERROR("readDir ::opendir returned " << errno2String(errno));
         return errno;
     }
     
@@ -323,7 +323,13 @@
 {
     LOGIT_DEBUG("removeFile " << path);
     if ( ::unlink( path.toString().c_str() ) == -1 ) {
-        LOGIT_ERROR("removeFile "<< path << "returned" << errno2String(errno));
+       if(errno == ENOENT)
+       {
+               // remove a file which does not exist: the result is ok 
+               // The file does not exist after this call. So return 0.
+               return 0;
+       }
+        LOGIT_ERROR("removeFile "<< path << " returned " << errno2String(errno));
         return errno;
     }
     return 0;
@@ -341,7 +347,7 @@
 {
     LOGIT_DEBUG("moveFile " << oldpath << " -> " << newpath);
     if ( ::rename( oldpath.toString().c_str(), newpath.toString().c_str() ) == -1 ) {
-        LOGIT_ERROR("moveFile " << oldpath << " -> " << newpath << "returned" << errno2String(errno));
+        LOGIT_ERROR("moveFile " << oldpath << " -> " << newpath << " returned " << errno2String(errno));
         return errno;
     }
     return 0 ;
@@ -391,7 +397,7 @@
             status = ps.exitStatus();
     }
     catch(const blocxx::Exception &e) {
-        LOGIT_ERROR( "copyFile exception:" << e);
+        LOGIT_ERROR( "copyFile exception: " << e);
     }
 #else
     try {
@@ -403,7 +409,7 @@
             status = WEXITSTATUS(execStatus);
     }
     catch(const blocxx::Exception &e) {
-        LOGIT_ERROR( "copyFile exception:" << e);
+        LOGIT_ERROR( "copyFile exception: " << e);
     }
 #endif
     if(status != 0) {
@@ -431,7 +437,7 @@
 {
     LOGIT_DEBUG("symLink " << newpath << " -> " << oldpath);
     if ( ::symlink( oldpath.toString().c_str(), newpath.toString().c_str() ) == -1 ) {
-        LOGIT_ERROR("symLink " << newpath << " -> " << oldpath << "returned " << errno2String(errno));
+        LOGIT_ERROR("symLink " << newpath << " -> " << oldpath << " returned " << errno2String(errno));
         return errno ;
     }
     return 0;
@@ -449,7 +455,7 @@
     LOGIT_DEBUG("changeMode " << path << ' ' << mode2String( mode ));
     if ( ::chmod( path.toString().c_str(), mode ) == -1 ) {
         LOGIT_ERROR("changeMode " << path << ' ' << mode2String( mode ) <<
-                    "returned " << errno2String(errno));
+                    " returned " << errno2String(errno));
         return errno;
     }
     return 0;

--
To unsubscribe, e-mail: limal-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: limal-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages