mirror of
https://github.com/stronk-dev/RandomChad.git
synced 2025-07-05 02:35:08 +02:00
Create output folder and converted folder if not existing
This commit is contained in:
parent
012547fe80
commit
0880dee377
@ -1,6 +1,8 @@
|
||||
import os
|
||||
import cairosvg
|
||||
from pathlib import Path
|
||||
|
||||
Path("./converted/").mkdir(parents=True, exist_ok=True)
|
||||
for file in os.listdir('./output'):
|
||||
name = file.split('.svg')[0]
|
||||
print('Converting ' + './output/' + name + '.svg' + ' -> ./converted/' + name + '.png')
|
||||
|
@ -165,7 +165,9 @@ module.exports = async function svgFromAttributes(attributes = [], path = "") {
|
||||
`<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">`,
|
||||
document.querySelector("svg").outerHTML,
|
||||
].join("");
|
||||
|
||||
|
||||
const dir = path.split('/').slice(0, -1).join('/');
|
||||
await fs.mkdir(dir, { recursive: true });
|
||||
console.log("Writing to `" + path + ".svg`...");
|
||||
await fs.writeFile(`${path}.svg`, bakedSvg);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user