[go: up one dir, main page]

Generate script extension tmpfile in the output file directory

Generate the temporary file passed to a script extension in the output file directory instead of the global temporary directory. This is necessary to maintain relative (href) paths in the SVG file.

Previously Inkscape saved the SVG to a temporary file in the global temporary directory. Afterwards it executed the script defined in the extension (passing the temporary file as an input) and then saved the result to the desired user location. As the original file path and the global temporary directory usually differ, Inkscape adjusts the (href) paths in the generated temporary file. But technically Inkscape would need to also adjust the script's output to adjust the paths to the actual output file directory, which cannot be practically done.

In case of the "Optimized SVG" script (executing the scour SVG optimizer) this behaviour usually causes the relative paths being converted to absolute paths in the output file, as the original file path is completly different from /tmp on Linux.

But in case of the original files being in a /tmp/test directory, it actually causes broken paths in the output file, as the relative path is adjusted to test/[original href], which doesn't work when the output file is saved in a location other than /tmp.

To solve this problem, save the temporary file in the same directory as the output file. This ensures that the adjusted relative path also is correct for the output file.

Fixes inbox#12311

Merge request reports

Loading