boxes_proxy (for Inkscape): Use temp file

Resolves permission issues when trying to place files into system extension
directory.

Resolves: #516
This commit is contained in:
Florian Festi 2023-02-08 22:52:40 +01:00
parent 455f5ae69a
commit 8b961797f9
1 changed files with 3 additions and 4 deletions

View File

@ -16,6 +16,7 @@ import inkex
import sys
import os
from lxml import etree
import tempfile
class boxesPyWrapper(inkex.GenerateExtension):
@ -31,9 +32,7 @@ class boxesPyWrapper(inkex.GenerateExtension):
pass #ignore duplicate id arg
def generate(self):
box_file = "box.svg"
if os.path.exists(box_file):
os.remove(box_file) #remove previously generated box file at the beginning
f, box_file = tempfile.mkstemp(".svg", "boxes.py-inkscape")
cmd = "boxes" #boxes.exe in this local dir (or if present in %PATH%), or boxes from $PATH in linux
for arg in vars(self.options):
@ -74,4 +73,4 @@ class boxesPyWrapper(inkex.GenerateExtension):
return group
if __name__ == '__main__':
boxesPyWrapper().run()
boxesPyWrapper().run()