mirror of
https://github.com/zen-browser/surfer.git
synced 2025-07-08 09:20:01 +02:00
👽️ Use rm
instead of rmdir
This commit is contained in:
parent
722fcb83eb
commit
d848fd1848
4 changed files with 9 additions and 22 deletions
|
@ -1,11 +1,4 @@
|
|||
import {
|
||||
existsSync,
|
||||
mkdirSync,
|
||||
readFileSync,
|
||||
rmdirSync,
|
||||
unlinkSync,
|
||||
writeFileSync,
|
||||
} from 'fs'
|
||||
import { existsSync, readFileSync, unlinkSync, writeFileSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
import { isMatch } from 'picomatch'
|
||||
import { ENGINE_DIR, MELON_TMP_DIR } from '../../constants'
|
||||
|
@ -15,6 +8,7 @@ import {
|
|||
AddonInfo,
|
||||
configDispatch,
|
||||
delay,
|
||||
ensureDir,
|
||||
walkDirectoryTree,
|
||||
windowsPathToUnix,
|
||||
} from '../../utils'
|
||||
|
@ -109,13 +103,7 @@ export async function unpackAddon(
|
|||
// I do not know why, but this delay causes unzip to work reliably
|
||||
await delay(200)
|
||||
|
||||
if (existsSync(outPath)) {
|
||||
rmdirSync(outPath, { recursive: true })
|
||||
}
|
||||
|
||||
mkdirSync(outPath, {
|
||||
recursive: true,
|
||||
})
|
||||
ensureDir(outPath)
|
||||
|
||||
await configDispatch('unzip', {
|
||||
args: [windowsPathToUnix(path), '-d', windowsPathToUnix(outPath)],
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import execa from 'execa'
|
||||
import { existsSync, mkdirSync, rmdirSync } from 'fs'
|
||||
import { existsSync } from 'fs'
|
||||
import { resolve } from 'path'
|
||||
import { bin_name } from '../..'
|
||||
import { BASH_PATH, ENGINE_DIR, MELON_TMP_DIR } from '../../constants'
|
||||
|
@ -30,8 +30,7 @@ export async function setupFirefoxSource(version: string) {
|
|||
async function unpackFirefoxSource(name: string): Promise<void> {
|
||||
log.info(`Unpacking Firefox...`)
|
||||
|
||||
if (existsSync(ENGINE_DIR)) rmdirSync(ENGINE_DIR)
|
||||
mkdirSync(ENGINE_DIR)
|
||||
ensureDir(ENGINE_DIR)
|
||||
|
||||
let tarExec = 'tar'
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
writeFileSync,
|
||||
copyFileSync,
|
||||
} from 'fs'
|
||||
import { copyFile, readFile, rmdir, writeFile } from 'fs/promises'
|
||||
import { copyFile, readFile, rm, writeFile } from 'fs/promises'
|
||||
import { every } from 'modern-async'
|
||||
import { dirname, extname, join } from 'path'
|
||||
import sharp from 'sharp'
|
||||
|
@ -113,7 +113,7 @@ async function setupImages(configPath: string, outputPath: string) {
|
|||
log.debug('Generating Mac Icons')
|
||||
const tmp = join(MELON_TMP_DIR, 'macos_icon_info.iconset')
|
||||
|
||||
if (existsSync(tmp)) await rmdir(tmp, { recursive: true })
|
||||
if (existsSync(tmp)) await rm(tmp, { recursive: true })
|
||||
|
||||
asyncIcns.convert({
|
||||
input: join(configPath, 'logo.png'),
|
||||
|
|
|
@ -6,7 +6,7 @@ import {
|
|||
existsSync,
|
||||
mkdirSync,
|
||||
openSync,
|
||||
rmdirSync,
|
||||
rmSync,
|
||||
writeSync,
|
||||
} from 'fs'
|
||||
import { mkdir, readdir, stat, symlink } from 'fs/promises'
|
||||
|
@ -168,7 +168,7 @@ export function filesExist(files: string[]): boolean {
|
|||
|
||||
export function ensureEmpty(path: string) {
|
||||
if (existsSync(path)) {
|
||||
rmdirSync(path, { recursive: true })
|
||||
rmSync(path, { recursive: true })
|
||||
}
|
||||
|
||||
mkdirSync(path, { recursive: true })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue