diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/file_manager/file_manager/foreground/js/file_manager_commands.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js index 937ff59..729e738 100644 --- a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js +++ b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js @@ -417,16 +417,16 @@ CommandHandler.COMMANDS_['format'] = { canExecute: function(event, fileManager) { var directoryModel = fileManager.directoryModel; var root = CommandUtil.getCommandEntry(event.target); + // |root| is null for unrecognized volumes. Regard such volumes as writable + // so that the format command is enabled. + var isReadOnly = root && fileManager.isOnReadonlyDirectory(); // See the comment in execute() for why doing this. if (!root) root = directoryModel.getCurrentDirEntry(); var location = root && fileManager.volumeManager.getLocationInfo(root); var removable = location && location.rootType === VolumeManagerCommon.RootType.REMOVABLE; - // Don't check if the volume is read-only. Unformatted volume is considered - // read-only per VolumeInfo.isReadOnly, but can be formatted. An error will - // be raised if formatting failed anyway. - event.canExecute = removable; + event.canExecute = removable && !isReadOnly; event.command.setHidden(!removable); } }; |