Merge branch 'master' of feistymeow.org:feisty_meow
[feisty_meow.git] / nucleus / library / filesystem / heavy_file_ops.cpp
index 1e63ba318f846d5cb899c79f841a1fe31e7028cf..6f5b19db1832feffb4e815c3df9c05069745a541 100644 (file)
@@ -27,7 +27,7 @@ using namespace structures;
 
 namespace filesystem {
 
-//#define DEBUG_HEAVY_FILE_OPS
+#define DEBUG_HEAVY_FILE_OPS
   // uncomment for noisier debugging.
 
 #undef LOG
@@ -235,14 +235,12 @@ outcome heavy_file_operations::buffer_files(const astring &source_root,
     const filename_list &to_transfer, file_transfer_header &last_action,
     byte_array &storage, int maximum_bytes)
 {
-#ifdef DEBUG_HEAVY_FILE_OPS
-//  FUNCDEF("buffer_files");
-#endif
+  FUNCDEF("buffer_files");
   storage.reset();  // clear out the current contents.
 
   if (!to_transfer.elements()) {
     // we seem to be done.
-    return OKAY;
+    return FINISHED;
   }
 
   outcome to_return = OKAY;
@@ -277,12 +275,13 @@ outcome heavy_file_operations::buffer_files(const astring &source_root,
     huge_file current(full_file, "rb");
     if (!current.good()) {
       // we need to skip this file.
+LOG(astring("skipping bad file: ") + full_file);
       if (!advance(to_transfer, last_action)) break;
       continue;
     }
 
-    if ((last_action._byte_start + last_action._length >= current.length())
-        && current.length()) {
+    if (last_action._byte_start + last_action._length >= current.length()) {
+LOG(astring("finished handling file: ") + full_file);
       // this file is done now.  go to the next one.
       if (!advance(to_transfer, last_action)) break;
       continue;