@ -339,7 +339,12 @@ export const FileExplorer = (props: FileExplorerProps) => {
try {
try {
const exists = await fileManager . exists ( dirName )
const exists = await fileManager . exists ( dirName )
if ( exists ) return
if ( exists ) {
return modal ( 'Rename File Failed' , ` A file or folder ${ extractNameFromKey ( newFolderPath ) } already exists at this location. Please choose a different name. ` , {
label : 'Close' ,
fn : ( ) = > { }
} , null )
}
await fileManager . mkdir ( dirName )
await fileManager . mkdir ( dirName )
setState ( prevState = > {
setState ( prevState = > {
return { . . . prevState , focusElement : [ { key : newFolderPath , type : 'folder' } ] }
return { . . . prevState , focusElement : [ { key : newFolderPath , type : 'folder' } ] }
@ -379,7 +384,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
const exists = await fileManager . exists ( newPath )
const exists = await fileManager . exists ( newPath )
if ( exists ) {
if ( exists ) {
modal ( 'Rename File Failed' , 'File name already exists' , {
modal ( 'Rename File Failed' , ` A file or folder ${ extractNameFromKey ( newPath ) } already exists at this location. Please choose a different name. ` , {
label : 'Close' ,
label : 'Close' ,
fn : ( ) = > { }
fn : ( ) = > { }
} , null )
} , null )
@ -894,8 +899,8 @@ export const FileExplorer = (props: FileExplorerProps) => {
const labelClass = state . focusEdit . element === file . path
const labelClass = state . focusEdit . element === file . path
? 'bg-light' : state . focusElement . findIndex ( item = > item . key === file . path ) !== - 1
? 'bg-light' : state . focusElement . findIndex ( item = > item . key === file . path ) !== - 1
? 'bg-secondary' : state . mouseOverElement === file . path
? 'bg-secondary' : state . mouseOverElement === file . path
? 'bg-secondary ' : ( state . focusContext . element === file . path ) && ( state . focusEdit . element !== file . path )
? 'bg-light border ' : ( state . focusContext . element === file . path ) && ( state . focusEdit . element !== file . path )
? 'bg-secondary ' : ''
? 'bg-light border ' : ''
if ( file . isDirectory ) {
if ( file . isDirectory ) {
return (
return (