Merge branch '1.3.x_branch' of bitbucket.org:blockstorage/repertory-ui into 1.3.x_branch
This commit is contained in:
@@ -34,7 +34,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class extends IPCCon
|
||||
state = {
|
||||
active_directory: '/',
|
||||
items: [],
|
||||
previous_directory: '',
|
||||
previous: [],
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@@ -89,11 +89,16 @@ export default connect(mapStateToProps, mapDispatchToProps)(class extends IPCCon
|
||||
<div key={'dir_' + idx} style={{...style}}>
|
||||
<Button buttonStyles={{textAlign: 'left'}}
|
||||
clicked={() => {
|
||||
const current_path = path === '..' ? '' : this.state.active_directory;
|
||||
const previous = [...this.state.previous];
|
||||
if (path === '..') {
|
||||
path = previous.pop();
|
||||
} else {
|
||||
previous.push(this.state.active_directory);
|
||||
}
|
||||
this.setState({
|
||||
items: [],
|
||||
active_directory: path === '..' ? this.state.previous_directory : path,
|
||||
previous_directory: current_path,
|
||||
active_directory: path,
|
||||
previous,
|
||||
}, () => {
|
||||
this.grabDirectoryItems();
|
||||
});
|
||||
|
||||
@@ -3,10 +3,15 @@ const fs = require('fs');
|
||||
const helpers = require('../../helpers');
|
||||
const path = require('path');
|
||||
|
||||
const getDirectories = source =>
|
||||
fs.readdirSync(source, {withFileTypes: true})
|
||||
const getDirectories = source => {
|
||||
try {
|
||||
return fs.readdirSync(source, {withFileTypes: true})
|
||||
.filter(dirent => dirent.isDirectory())
|
||||
.map(dirent => dirent.name)
|
||||
.map(dirent => dirent.name);
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
const addListeners = ipcMain => {
|
||||
ipcMain.on(Constants.IPC_Get_State, event => {
|
||||
|
||||
Reference in New Issue
Block a user