File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ import { openModal } from 'reducers/modals'
2424import { addAlert } from 'reducers/alerts'
2525import { setPreview } from 'actions/preview'
2626
27- import { fileDialog , saveDialog , fsWriteFile } from 'helpers/fs'
27+ import { fileDialog , saveDialog , fsWriteFile , fileExists } from 'helpers/fs'
2828
2929import Button from 'components/Button'
3030import ButtonDropdown from 'components/Button/ButtonDropdown'
@@ -99,9 +99,13 @@ export default connect(
9999
100100 handleRemoveFile = async fileName => {
101101 try {
102- if ( ( await trash ( fileName ) ) === undefined ) {
103- throw new Error ( 'No file was deleted' )
102+ const trashed = await trash ( fileName )
103+ const stillExists = await fileExists ( fileName )
104+
105+ if ( stillExists ) {
106+ throw new Error ( 'File still exists' )
104107 }
108+
105109 this . props . addAlert ( 'File successfully removed' , 'success' )
106110 } catch ( e ) {
107111 this . props . addAlert ( 'Could not delete file' , 'error' )
You can’t perform that action at this time.
0 commit comments