File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ export class JsEnginePluginSettingTab extends PluginSettingTab {
7878
7979 const oldScripts = settings . startupScripts
8080 . map ( file => vault . getFileByPath ( file ) ! )
81- . filter ( file => ! file . parent ?. path . startsWith ( settings . startupScriptsDirectory ?? '' ) ) ;
81+ . filter ( file => ! this . isParentDir ( file , settings . startupScriptsDirectory ?? '/ ' ) ) ;
8282 if ( oldScripts . length > 0 ) {
8383 this . containerEl . createEl ( 'div' , { cls : 'callout js-engine-settings-warning' , text : 'These scripts are not in the Snippets Folder' } ) ;
8484 for ( const file of oldScripts ) {
@@ -112,6 +112,12 @@ export class JsEnginePluginSettingTab extends PluginSettingTab {
112112 return files . filter ( f => f . extension == 'js' ) . concat ( folders . flatMap ( dir => this . listJSfilesInDirectory ( dir ) ) ) ;
113113 }
114114
115+ isParentDir ( pathnode : TFile | TFolder , parent : string ) : boolean {
116+ if ( pathnode . parent == null ) return false ;
117+ if ( pathnode . parent . path == parent ) return true ;
118+ return this . isParentDir ( pathnode . parent , parent ) ;
119+ }
120+
115121 async toggleStartupScript ( file : TFile , enable : boolean ) : Promise < void > {
116122 const settings = this . plugin . settings ;
117123 if ( enable ) {
You can’t perform that action at this time.
0 commit comments