Quellcode durchsuchen

*** empty log message ***

Mike Goslin vor 25 Jahren
Ursprung
Commit
bce3983f1f
2 geänderte Dateien mit 48 neuen und 3 gelöschten Zeilen
  1. 40 2
      panda/src/downloader/downloader.cxx
  2. 8 1
      panda/src/downloader/downloader.h

+ 40 - 2
panda/src/downloader/downloader.cxx

@@ -324,7 +324,7 @@ initiate(const string &file_name, Filename file_dest,
     downloader_cat.error()
       << "Downloader::initiate() - Error opening file: " << file_dest
       << " for writing: " << strerror(errno) << endl;
-    return DL_error_write;
+    return get_write_error();
   }
 
   // Send an HTTP request for the file to the server
@@ -807,7 +807,7 @@ handle_socket_error(void) const {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: Downloader::error_gethostbyname
+//     Function: Downloader::get_network_error
 //       Access: Private
 //  Description:
 ////////////////////////////////////////////////////////////////////
@@ -849,3 +849,41 @@ get_network_error(void) const {
   }
 #endif
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: Downloader::get_write_error
+//       Access: Private
+//  Description:
+////////////////////////////////////////////////////////////////////
+int Downloader::
+get_write_error(void) const {
+#ifndef WIN32
+  return DL_error_abort;
+#else
+  switch (errno) {
+    case 4:
+    case 18:
+      return DL_error_write_out_of_files;
+    case 8:
+    case 14:
+      return DL_error_write_out_of_memory;
+    case 20:
+      return DL_error_write_disk_not_found;
+    case 25:
+    case 27:
+      return DL_error_write_disk_sector_not_found;
+    case 29:
+    case 30:
+    case 31:
+      return DL_error_write_disk_fault;
+    case 32:
+    case 33:
+    case 36:
+      return DL_error_write_sharing_violation;
+    case 39:
+      return DL_error_write_disk_full;
+    default:
+      return DL_error_abort;
+  }
+#endif
+}

+ 8 - 1
panda/src/downloader/downloader.h

@@ -62,7 +62,13 @@ PUBLISHED:
     DL_error_network_remote_host_no_response = -54,
 
     // General local errors
-    DL_error_write = -60,
+    DL_error_write_out_of_files = -60,
+    DL_error_write_out_of_memory = -61,
+    DL_error_write_sharing_violation = -62,
+    DL_error_write_disk_full = -63,
+    DL_error_write_disk_not_found = -64,
+    DL_error_write_disk_sector_not_found = -65,
+    DL_error_write_disk_fault = -66,
 
     // HTTP errors
     DL_error_http_server_timeout = -70,
@@ -126,6 +132,7 @@ private:
   char *handle_socket_error(void) const;
 
   int get_network_error(void) const;
+  int get_write_error(void) const;
 
 private:
   bool _connected;