Skip to content

Commit

Permalink
Safely recursive creation of dirs as parent dir may not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
younglim committed Jul 12, 2024
1 parent 291c381 commit 2cd48cd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/constants/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ const cloneChromeProfileCookieFiles = (options, destDir) => {
if (!fs.existsSync(destProfileDir)) {
fs.mkdirSync(destProfileDir, { recursive: true });
if (!fs.existsSync(destProfileDir)) {
fs.mkdirSync(destProfileDir);
fs.mkdirSync(destProfileDir, { recursive: true });
}
}

Expand Down Expand Up @@ -1299,7 +1299,7 @@ const cloneEdgeProfileCookieFiles = (options, destDir) => {
if (!fs.existsSync(destProfileDir)) {
fs.mkdirSync(destProfileDir, { recursive: true });
if (!fs.existsSync(destProfileDir)) {
fs.mkdirSync(destProfileDir);
fs.mkdirSync(destProfileDir, { recursive: true });
}
}

Expand Down Expand Up @@ -1404,7 +1404,7 @@ export const cloneChromeProfiles = (randomToken?: string): string => {
}

if (!fs.existsSync(destDir)) {
fs.mkdirSync(destDir);
fs.mkdirSync(destDir, { recursive: true });
}

const baseOptions = {
Expand Down Expand Up @@ -1437,7 +1437,7 @@ export const cloneChromiumProfiles = (randomToken?: string): string => {
}

if (!fs.existsSync(destDir)) {
fs.mkdirSync(destDir);
fs.mkdirSync(destDir, { recursive: true });
}

return destDir;
Expand Down Expand Up @@ -1473,7 +1473,7 @@ export const cloneEdgeProfiles = (randomToken?: string): string => {
}

if (!fs.existsSync(destDir)) {
fs.mkdirSync(destDir);
fs.mkdirSync(destDir, { recursive: true });
}

const baseOptions = {
Expand Down

0 comments on commit 2cd48cd

Please sign in to comment.