File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -682,7 +682,7 @@ class BunKill {
682682 }
683683
684684 private shouldSkipDirectory ( dirPath : string ) : boolean {
685- const skipPatterns = [
685+ const absoluteSkipRoots = [
686686 "/System" ,
687687 "/Library/Application Support" ,
688688 "/Library/Frameworks" ,
@@ -705,6 +705,9 @@ class BunKill {
705705 "/opt/homebrew" ,
706706 "/usr/local/bin" ,
707707 "/usr/local/sbin" ,
708+ ] ;
709+
710+ const nameSkipPatterns = [
708711 ".photolibrary" ,
709712 ".photoslibrary" ,
710713 ".photoboothlibrary" ,
@@ -743,9 +746,19 @@ class BunKill {
743746 return false ;
744747 }
745748
746- return skipPatterns . some ( ( pattern ) =>
747- dirPath . includes ( pattern ) ||
748- dirPath . toLowerCase ( ) . includes ( pattern . toLowerCase ( ) )
749+ const normalizedPath = dirPath . toLowerCase ( ) ;
750+ const isAbsoluteSkip = absoluteSkipRoots . some ( ( root ) => {
751+ const normalizedRoot = root . toLowerCase ( ) ;
752+ return normalizedPath === normalizedRoot ||
753+ normalizedPath . startsWith ( `${ normalizedRoot } /` ) ;
754+ } ) ;
755+
756+ if ( isAbsoluteSkip ) {
757+ return true ;
758+ }
759+
760+ return nameSkipPatterns . some ( ( pattern ) =>
761+ normalizedPath . includes ( pattern . toLowerCase ( ) )
749762 ) ;
750763 }
751764
You can’t perform that action at this time.
0 commit comments