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 d3658301d913df00a9a97c0af779841d4034f9ee..cf7c001377843cc9e2b163b6666d509e5c43cc37 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 |
@@ -504,16 +504,17 @@ CommandHandler.COMMANDS_['format'] = /** @type {Command} */ ({ |
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(); |
+ // |root| is null for unrecognized volumes. Enable format command for such |
+ // volumes. |
+ var isUnrecognizedVolume = (root == null); |
// See the comment in execute() for why doing this. |
if (!root) |
root = directoryModel.getCurrentDirEntry(); |
var location = root && fileManager.volumeManager.getLocationInfo(root); |
+ var writable = location && !location.isReadOnly; |
var removable = location && location.rootType === |
VolumeManagerCommon.RootType.REMOVABLE; |
- event.canExecute = removable && !isReadOnly; |
+ event.canExecute = removable && (isUnrecognizedVolume || writable); |
event.command.setHidden(!removable); |
} |
}); |