瀏覽代碼

URL fix for plugin as well. Oh, let's force logfile 3 to be in a temp dir, because letting the user specify it would be a security leak.

rdb 16 年之前
父節點
當前提交
8585dd6cb3
共有 2 個文件被更改,包括 16 次插入1 次删除
  1. 10 1
      direct/src/plugin/p3dSession.cxx
  2. 6 0
      direct/src/plugin_npapi/ppInstance.cxx

+ 10 - 1
direct/src/plugin/p3dSession.cxx

@@ -54,7 +54,16 @@ P3DSession(P3DInstance *inst) {
   _started_read_thread = false;
   _started_read_thread = false;
   _read_thread_continue = false;
   _read_thread_continue = false;
 
 
-  _output_filename = inst->get_fparams().lookup_token("output_filename");
+#ifdef _WIN32
+  static const size_t buffer_size = 4096;
+  char buffer[buffer_size];
+  if (GetTempPath(buffer_size, buffer) != 0) {
+    _output_filename = buffer;
+    _output_filename += "panda3d.3.log";
+  }
+#else
+  _output_filename = "/tmp/panda3d.3.log";
+#endif  // _WIN32
 
 
   _panda3d_callback = NULL;
   _panda3d_callback = NULL;
 
 

+ 6 - 0
direct/src/plugin_npapi/ppInstance.cxx

@@ -105,6 +105,9 @@ begin() {
   if (!is_plugin_loaded()) {
   if (!is_plugin_loaded()) {
     // Go download the contents file, so we can download the core DLL.
     // Go download the contents file, so we can download the core DLL.
     string url = P3D_PLUGIN_DOWNLOAD;
     string url = P3D_PLUGIN_DOWNLOAD;
+    if (!url.empty() && url[url.length() - 1] != '/') {
+      url += '/';
+    }
     url += "contents.xml";
     url += "contents.xml";
     PPDownloadRequest *req = new PPDownloadRequest(PPDownloadRequest::RT_contents_file);
     PPDownloadRequest *req = new PPDownloadRequest(PPDownloadRequest::RT_contents_file);
     start_download(url, req);
     start_download(url, req);
@@ -827,6 +830,9 @@ get_core_api(TiXmlElement *xpackage) {
   } else {
   } else {
     // The DLL file needs to be downloaded.  Go get it.
     // The DLL file needs to be downloaded.  Go get it.
     string url = P3D_PLUGIN_DOWNLOAD;
     string url = P3D_PLUGIN_DOWNLOAD;
+    if (!url.empty() && url[url.length() - 1] != '/') {
+      url += '/';
+    }
     url += _core_api_dll.get_filename();
     url += _core_api_dll.get_filename();
     
     
     PPDownloadRequest *req = new PPDownloadRequest(PPDownloadRequest::RT_core_dll);
     PPDownloadRequest *req = new PPDownloadRequest(PPDownloadRequest::RT_core_dll);