Skip to content

Commit fa19956

Browse files
committed
Bug fixed: Unable to create multi-level non-existent folders on linux system
1 parent fedf73a commit fa19956

File tree

3 files changed

+1
-17
lines changed

3 files changed

+1
-17
lines changed

src/api.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
logStatistics,
1717
logSuccess,
1818
logWarn,
19-
mkdirDirSync,
2019
random
2120
} from './utils'
2221

@@ -868,7 +867,7 @@ function fileSingleResultHandle(
868867
detailTargetConfig.storeDir &&
869868
!fs.existsSync(detailTargetConfig.storeDir)
870869
) {
871-
mkdirDirSync(detailTargetConfig.storeDir)
870+
fs.mkdirSync(detailTargetConfig.storeDir, { recursive: true })
872871
}
873872

874873
const storePath = detailTargetConfig.storeDir ?? __dirname

src/controller.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
isUndefined,
1515
log,
1616
logError,
17-
logNumber,
1817
logStart,
1918
logStatistics,
2019
logSuccess,

src/utils.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,6 @@ export function random(max: number, min = 0) {
1616
return result
1717
}
1818

19-
export function mkdirDirSync(dir: string) {
20-
const dirSplit = path.resolve(dir).split(path.sep)
21-
22-
dirSplit.reduce((prev, item, index) => {
23-
const currentDir = index !== 0 ? path.join(prev, item) : item
24-
25-
if (!fs.existsSync(currentDir)) {
26-
fs.mkdirSync(currentDir)
27-
}
28-
29-
return currentDir
30-
}, '')
31-
}
32-
3319
export const log = console.log
3420
export const logStart = chalk.blueBright
3521
export const logStatistics = chalk.whiteBright

0 commit comments

Comments
 (0)