12345678910111213141516171819202122232425262728293031323334353637 |
- import fs from 'node:fs';
- import path from 'node:path';
- const TEMP_PATH_NAME = 'temp';
- console.log(__dirname);
- export function getRootPath() {
- return __dirname;
- }
- export function getTempPath() {
- return path.join(getRootPath(), TEMP_PATH_NAME);
- }
- export function getImagicPath() {
- return path.join(
- getRootPath(),
- '../../resources/imagemagick-7.1.1-11/magick.exe'
- );
- }
- export function makeDirSync(pathContent: string) {
- const mkPathList: string[] = [];
- let curPath = pathContent;
- while (!fs.existsSync(curPath)) {
- mkPathList.unshift(curPath);
- curPath = path.dirname(curPath);
- }
- mkPathList.forEach((mpath) => {
- fs.mkdirSync(mpath);
- });
- }
- makeDirSync(getTempPath());
|