@@ -46,7 +46,7 @@ module.exports = {
4646 console . log ( 'Running afterCopyExtraResources hook...' ) ;
4747 console . log ( { arch, buildPath, electronVersion, platform } ) ;
4848
49- const chromiumDir = path . join (
49+ const localBrowsersDir = path . join (
5050 buildPath ,
5151 'Loadmill.app' ,
5252 'Contents' ,
@@ -57,22 +57,41 @@ module.exports = {
5757 '.local-browsers' ,
5858 ) ;
5959
60- console . log ( { chromiumDir } ) ;
60+ console . log ( { localBrowsersDir } ) ;
6161
6262 try {
63- const matches = glob . sync (
64- path . join ( chromiumDir , '**/gpu_shader_cache.bin' ) ,
65- { nodir : true } ,
66- ) ;
63+ console . log ( 'Attempting to remove .tbd files from .local-browsers...' ) ;
64+ // Check if the localBrowsers directory exists
65+ if ( fs . existsSync ( localBrowsersDir ) ) {
66+ console . log ( '.local-browsers directory found, searching for .tbd files...' ) ;
6767
68- matches . forEach ( file => {
69- console . log ( `Changing permissions for: ${ file } ` ) ;
70- fs . chmodSync ( file , 0o644 ) ;
71- } ) ;
68+ // Find all .tbd files recursively in the .local-browsers directory
69+ const tbdFiles = glob . sync ( '**/*.tbd' , {
70+ absolute : true ,
71+ cwd : localBrowsersDir ,
72+ } ) ;
7273
73- console . log ( 'Permissions changed successfully.' ) ;
74+ console . log ( `Found ${ tbdFiles . length } .tbd files:` , tbdFiles ) ;
75+
76+ let removedCount = 0 ;
77+ tbdFiles . forEach ( tbdFile => {
78+ try {
79+ console . log ( `Removing... ${ tbdFile } ` ) ;
80+ fs . unlinkSync ( tbdFile ) ;
81+ console . log ( `Removed: ${ tbdFile } ` ) ;
82+ removedCount ++ ;
83+ } catch ( unlinkErr ) {
84+ console . warn ( `Failed to remove ${ tbdFile } :` , unlinkErr . message ) ;
85+ }
86+ } ) ;
87+
88+ console . log ( 'Finished removing .tbd files' ) ;
89+ console . log ( `Total .tbd files removed: ${ removedCount } ` ) ;
90+ } else {
91+ console . log ( '.local-browsers directory not found, skipping .tbd file removal' ) ;
92+ }
7493 } catch ( err ) {
75- console . warn ( 'Permission fix failed (may be fine if files don’t exist): ' , err . message ) ;
94+ console . warn ( 'Removing .tbd files failed ' , err . message ) ;
7695 }
7796
7897 callback ( ) ;
0 commit comments