File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -12,21 +12,22 @@ const PATH_USER_DEFAULT_IMAGE: string = '/usr/share/codam/web-greeter/user.png';
1212
1313export class GreeterImage {
1414 private _path : string ;
15- private _exists : boolean ;
15+ private _exists : boolean = false ;
1616
1717 public constructor ( path : string ) {
1818 this . _path = path ;
1919
2020 // Check if file exists
2121 const dir = this . _path . split ( '/' ) . slice ( 0 , - 1 ) . join ( '/' ) ;
22- const dirFiles = window . theme_utils ?. dirlist_sync ( dir , false ) ;
23- this . _exists = ( dirFiles !== undefined && dirFiles . includes ( this . _path ) ) ;
24- if ( ! this . _exists ) {
25- console . warn ( 'Wallpaper file does not exist: ' + this . _path ) ;
26- return ;
27- }
28-
29- console . log ( `Found image at "${ this . _path } "` ) ;
22+ const self = this ;
23+ window . theme_utils ?. dirlist ( dir , false , ( dirFiles : string [ ] | undefined ) => {
24+ self . _exists = ( dirFiles !== undefined && dirFiles . includes ( self . _path ) ) ;
25+ if ( ! self . _exists ) {
26+ console . warn ( 'Image file does not exist: ' + self . _path ) ;
27+ return ;
28+ }
29+ console . log ( `Found image at "${ self . _path } "` ) ;
30+ } ) ;
3031 }
3132
3233 public get path ( ) : string {
You can’t perform that action at this time.
0 commit comments