Index: ui/file_manager/file_manager/foreground/js/file_manager_commands.js |
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 937ff593f7a055ac972c28ee2deac0726e28420f..729e738b7af7fc6bc902992bda9c3d3659d353da 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); |
} |
}; |