@@ -23,6 +23,7 @@ import { ProjectMetaInterface } from '@valist/sdk/dist/typesShared'
23
23
import getPartitionCookies from 'backend/utils/get_partition_cookies'
24
24
import { DEV_PORTAL_URL } from 'common/constants'
25
25
import { captureException } from '@sentry/electron'
26
+ import { access , rm } from 'fs/promises'
26
27
27
28
export async function getHyperPlayStoreRelease (
28
29
appName : string
@@ -452,16 +453,13 @@ export async function safeRemoveDirectory(
452
453
// Log start of removal process
453
454
logInfo ( `Starting removal of directory ${ directory } ` , LogPrefix . HyperPlay )
454
455
455
- // Import fs promises for async operations only when needed
456
- const fsPromises = await import ( 'fs/promises' )
457
-
458
456
for ( let attempt = 1 ; attempt <= maxRetries ; attempt ++ ) {
459
457
try {
460
458
// Use different removal strategies based on expected size
461
459
// For directories larger than threshold, use async removal to not block the main thread
462
460
if ( sizeThresholdMB > 250 ) {
463
461
try {
464
- await fsPromises . rm ( directory , {
462
+ await rm ( directory , {
465
463
recursive : true ,
466
464
force : true ,
467
465
maxRetries : 3
@@ -481,7 +479,7 @@ export async function safeRemoveDirectory(
481
479
482
480
// Verify directory was actually removed
483
481
try {
484
- await fsPromises . access ( directory )
482
+ await access ( directory )
485
483
// If we get here, directory still exists
486
484
logWarning (
487
485
`Failed to remove directory ${ directory } on attempt ${ attempt } /${ maxRetries } , directory still exists` ,
0 commit comments