Better filename display construction

pull/14/head
Sam Bosley 13 years ago
parent 0448778d64
commit 81be7a185c

@ -195,13 +195,13 @@ public class FilesControlSet extends PopupControlSet {
} }
private String getNameString(Metadata metadata) { private String getNameString(Metadata metadata) {
int fileType = metadata.getValue(FileMetadata.FILE_TYPE); File f = new File(metadata.getValue(FileMetadata.FILE_PATH));
if (fileType == FileMetadata.FILE_TYPE_AUDIO || fileType == FileMetadata.FILE_TYPE_IMG) { String name = f.getName();
if (name.matches("\\d+_\\d+_\\w+.\\w+")) { //$NON-NLS-1$
Date date = new Date(metadata.getValue(FileMetadata.ATTACH_DATE)); Date date = new Date(metadata.getValue(FileMetadata.ATTACH_DATE));
return DateUtilities.getDateStringWithTime(activity, date); return DateUtilities.getDateStringWithTime(activity, date);
} else { } else {
File f = new File(metadata.getValue(FileMetadata.FILE_PATH));
String name = f.getName();
int extension = name.lastIndexOf('.'); int extension = name.lastIndexOf('.');
if (extension < 0) if (extension < 0)
return name; return name;

Loading…
Cancel
Save