aboutsummaryrefslogtreecommitdiff
path: root/src/com/cyanogenmod/filemanager/commands/java/FolderUsageCommand.java
diff options
context:
space:
mode:
authorMatt Garnes <matt@cyngn.com>2015-03-23 17:52:59 -0700
committerMatt Garnes <matt@cyngn.com>2015-03-26 17:26:33 +0000
commit6e039982eb0d6f8bc39d8690f67b2622ec1efcb0 (patch)
tree38ffa8a94ca22bdc860fe7ed8f904f675d7ddd23 /src/com/cyanogenmod/filemanager/commands/java/FolderUsageCommand.java
parent1288edb9bc0b752d157af7f17d00de52bcf61652 (diff)
Support ambigous file extension mimetypes.
Previously, CMFileManager operated under the assumption that file extensions map to exactly one mimetype. This is not true in some cases, such as .3gp files, which can have an audio or video mimetype. Add support so that in mime_types.properties we can specify a comma separated list of mimetype info that are matched with a given extension. If an AmbiguousExtensionHelper subclass implementation is provided for one of these extensions, this is used to determine the correct mimetype for the file. Change-Id: Ie73d6ad646692dfeac112ac50c1c6436e6b5559b
Diffstat (limited to 'src/com/cyanogenmod/filemanager/commands/java/FolderUsageCommand.java')
-rw-r--r--src/com/cyanogenmod/filemanager/commands/java/FolderUsageCommand.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/com/cyanogenmod/filemanager/commands/java/FolderUsageCommand.java b/src/com/cyanogenmod/filemanager/commands/java/FolderUsageCommand.java
index c201dfb..d15c5dc 100644
--- a/src/com/cyanogenmod/filemanager/commands/java/FolderUsageCommand.java
+++ b/src/com/cyanogenmod/filemanager/commands/java/FolderUsageCommand.java
@@ -24,6 +24,7 @@ import com.cyanogenmod.filemanager.console.ExecutionException;
import com.cyanogenmod.filemanager.console.InsufficientPermissionsException;
import com.cyanogenmod.filemanager.console.NoSuchFileOrDirectory;
import com.cyanogenmod.filemanager.model.FolderUsage;
+import com.cyanogenmod.filemanager.util.FileHelper;
import com.cyanogenmod.filemanager.util.MimeTypeHelper;
import com.cyanogenmod.filemanager.util.MimeTypeHelper.MimeTypeCategory;
@@ -149,8 +150,12 @@ public class FolderUsageCommand extends Program implements FolderUsageExecutable
} else {
this.mFolderUsage.addFile();
// Compute statistics and size
+ File file = files[i];
+ String ext = FileHelper.getExtension(file.getName());
MimeTypeCategory category =
- MimeTypeHelper.getCategory(null, files[i]);
+ MimeTypeHelper.getCategoryFromExt(null,
+ ext,
+ file.getAbsolutePath());
this.mFolderUsage.addFileToCategory(category);
this.mFolderUsage.addSize(files[i].length());
}