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,11 +682,8 @@ class BunKill {
682682 }
683683
684684 private shouldSkipDirectory ( dirPath : string ) : boolean {
685- const skipPatterns = [
685+ const absoluteSkipRoots = [
686686 "/System" ,
687- "/Library/Application Support" ,
688- "/Library/Frameworks" ,
689- "/Applications" ,
690687 "/private" ,
691688 "/dev" ,
692689 "/proc" ,
@@ -705,6 +702,15 @@ class BunKill {
705702 "/opt/homebrew" ,
706703 "/usr/local/bin" ,
707704 "/usr/local/sbin" ,
705+ ] ;
706+
707+ const pathContainsSkipPatterns = [
708+ "/Library/Application Support" ,
709+ "/Library/Frameworks" ,
710+ "/Applications" ,
711+ ] ;
712+
713+ const nameSkipPatterns = [
708714 ".photolibrary" ,
709715 ".photoslibrary" ,
710716 ".photoboothlibrary" ,
@@ -743,9 +749,27 @@ class BunKill {
743749 return false ;
744750 }
745751
746- return skipPatterns . some ( ( pattern ) =>
747- dirPath . includes ( pattern ) ||
748- dirPath . toLowerCase ( ) . includes ( pattern . toLowerCase ( ) )
752+ const normalizedPath = dirPath . toLowerCase ( ) ;
753+ const isAbsoluteSkip = absoluteSkipRoots . some ( ( root ) => {
754+ const normalizedRoot = root . toLowerCase ( ) ;
755+ return normalizedPath === normalizedRoot ||
756+ normalizedPath . startsWith ( `${ normalizedRoot } /` ) ;
757+ } ) ;
758+
759+ if ( isAbsoluteSkip ) {
760+ return true ;
761+ }
762+
763+ if (
764+ pathContainsSkipPatterns . some ( ( pattern ) =>
765+ normalizedPath . includes ( pattern . toLowerCase ( ) )
766+ )
767+ ) {
768+ return true ;
769+ }
770+
771+ return nameSkipPatterns . some ( ( pattern ) =>
772+ normalizedPath . includes ( pattern . toLowerCase ( ) )
749773 ) ;
750774 }
751775
You can’t perform that action at this time.
0 commit comments