mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 04:05:54 +08:00
Create persistent temporary file on Windows for plugins
CURA-3856
This commit is contained in:
parent
44a22cbd3a
commit
8827b02020
@ -100,9 +100,16 @@ class PluginBrowser(QObject, Extension):
|
|||||||
if new_progress == 100.0:
|
if new_progress == 100.0:
|
||||||
self.setIsDownloading(False)
|
self.setIsDownloading(False)
|
||||||
self._download_plugin_reply.downloadProgress.disconnect(self._onDownloadPluginProgress)
|
self._download_plugin_reply.downloadProgress.disconnect(self._onDownloadPluginProgress)
|
||||||
self._temp_plugin_file = tempfile.NamedTemporaryFile(suffix = ".curaplugin")
|
|
||||||
self._temp_plugin_file.write(self._download_plugin_reply.readAll())
|
# must not delete the temporary file on Windows
|
||||||
|
self._temp_plugin_file = tempfile.NamedTemporaryFile(mode = "w+b", suffix = ".curaplugin", delete = False)
|
||||||
location = self._temp_plugin_file.name
|
location = self._temp_plugin_file.name
|
||||||
|
|
||||||
|
# write first and close, otherwise on Windows, it cannot read the file
|
||||||
|
self._temp_plugin_file.write(self._download_plugin_reply.readAll())
|
||||||
|
self._temp_plugin_file.close()
|
||||||
|
|
||||||
|
# open as read
|
||||||
if not location.startswith("/"):
|
if not location.startswith("/"):
|
||||||
location = "/" + location # Ensure that it starts with a /, as otherwise it doesn't work on windows.
|
location = "/" + location # Ensure that it starts with a /, as otherwise it doesn't work on windows.
|
||||||
result = PluginRegistry.getInstance().installPlugin("file://" + location)
|
result = PluginRegistry.getInstance().installPlugin("file://" + location)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user