@@ -187,7 +187,8 @@ function DirectoryTable({
187187 ) ;
188188
189189 const setEntryManagerProps = useSetAtom ( entryManagerOverlayPropsAtom ) ;
190- const canCreateEntries = useAtomValue ( model . statFile ) . supportsmkdir ?? true ;
190+ const stat = useAtomValue ( model . statFile ) ;
191+ const canCreateEntries = stat ?. supportsmkdir === true ;
191192
192193 const updateName = useCallback (
193194 ( path : string , isDir : boolean ) => {
@@ -327,7 +328,9 @@ function TableBody({
327328 const dummyLineRef = useRef < HTMLDivElement > ( null ) ;
328329 const warningBoxRef = useRef < HTMLDivElement > ( null ) ;
329330 const conn = useAtomValue ( model . connection ) ;
330- const canCreateEntries = useAtomValue ( model . statFile ) . supportsmkdir ?? true ;
331+ const stat = useAtomValue ( model . statFile ) ;
332+ const canCreateEntries = stat ?. supportsmkdir === true ;
333+ const canMutateEntries = stat != null && ( stat . path !== "/" || stat . supportsmkdir === true ) ;
331334 const setErrorMsg = useSetAtom ( model . errorMsgAtom ) ;
332335
333336 useEffect ( ( ) => {
@@ -384,18 +387,22 @@ function TableBody({
384387 click : ( ) => {
385388 table . options . meta . newDirectory ( ) ;
386389 } ,
387- } ,
388- {
389- label : "Rename" ,
390- click : ( ) => {
391- table . options . meta . updateName ( finfo . path , finfo . isdir ) ;
392- } ,
393- } ,
394- {
395- type : "separator" ,
396390 }
397391 ) ;
398392 }
393+ if ( canMutateEntries ) {
394+ menu . push ( {
395+ label : "Rename" ,
396+ click : ( ) => {
397+ table . options . meta . updateName ( finfo . path , finfo . isdir ) ;
398+ } ,
399+ } ) ;
400+ }
401+ if ( canCreateEntries || canMutateEntries ) {
402+ menu . push ( {
403+ type : "separator" ,
404+ } ) ;
405+ }
399406 menu . push (
400407 {
401408 label : "Copy File Name" ,
@@ -422,7 +429,7 @@ function TableBody({
422429 label : "Default Settings" ,
423430 submenu : makeDirectoryDefaultMenuItems ( model ) ,
424431 } ) ;
425- if ( canCreateEntries ) {
432+ if ( canMutateEntries ) {
426433 menu . push (
427434 {
428435 type : "separator" ,
@@ -435,7 +442,7 @@ function TableBody({
435442 }
436443 ContextMenuModel . getInstance ( ) . showContextMenu ( menu , e ) ;
437444 } ,
438- [ canCreateEntries , conn , setErrorMsg ]
445+ [ canCreateEntries , canMutateEntries , conn , setErrorMsg ]
439446 ) ;
440447
441448 const allRows = table . getRowModel ( ) . flatRows ;
@@ -580,7 +587,7 @@ function DirectoryPreview({ model }: DirectoryPreviewProps) {
580587 const conn = useAtomValue ( model . connection ) ;
581588 const blockData = useAtomValue ( model . blockAtom ) ;
582589 const finfo = useAtomValue ( model . statFile ) ;
583- const canCreateEntries = finfo ?. supportsmkdir ?? true ;
590+ const canCreateEntries = finfo ?. supportsmkdir === true ;
584591 const dirPath = finfo ?. path ;
585592 const setErrorMsg = useSetAtom ( model . errorMsgAtom ) ;
586593
0 commit comments