[Build] Improve treeWalker, renderer & wallpaper finder
This commit is contained in:
@@ -4,13 +4,16 @@ const fs = require( 'fs' );
|
||||
const path = require( 'path' );
|
||||
const os = require( 'os' );
|
||||
const render = require( './render' );
|
||||
const { treeWalker } = require('./util');
|
||||
|
||||
|
||||
// Prompt user to select a wallpaper (if no path is passed as argument)
|
||||
const wallpapers = fs.readdirSync( path.join( os.homedir(), '/NextCloud/Wallpapers' ) );
|
||||
const wallpapers = treeWalker( path.join( os.homedir(), '/NextCloud/Wallpapers' ), '*' );
|
||||
// const wallpapers = fs.readdirSync( path.join( os.homedir(), '/NextCloud/Wallpapers' ) );
|
||||
const wallpaperChoices = [];
|
||||
wallpapers.forEach(element => {
|
||||
wallpaperChoices.push( { 'name': element.split( '.' )[ 0 ], 'value': element } );
|
||||
const name = element.split( '/' );
|
||||
wallpaperChoices.push( { 'name': name[ name.length - 1 ].split( '.' )[ 0 ], 'value': element } );
|
||||
});
|
||||
|
||||
|
||||
@@ -49,5 +52,5 @@ inquirer.default.prompt( [
|
||||
chooseLockpaper,
|
||||
chooseTheme
|
||||
] ).then( answers => {
|
||||
render( path.join( os.homedir(), '/NextCloud/Wallpapers', answers.wallpaper ), path.join( os.homedir(), '/NextCloud/Wallpapers', answers.lockpaper ), answers.theme );
|
||||
render( answers.wallpaper, answers.lockpaper, answers.theme );
|
||||
} );
|
||||
|
Reference in New Issue
Block a user