mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Create persistent temporary file on Windows for plugins
CURA-3856
This commit is contained in:
parent
44a22cbd3a
commit
8827b02020
1 changed files with 9 additions and 2 deletions
|
@ -100,9 +100,16 @@ class PluginBrowser(QObject, Extension):
|
|||
if new_progress == 100.0:
|
||||
self.setIsDownloading(False)
|
||||
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
|
||||
|
||||
# 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("/"):
|
||||
location = "/" + location # Ensure that it starts with a /, as otherwise it doesn't work on windows.
|
||||
result = PluginRegistry.getInstance().installPlugin("file://" + location)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue