tryAppendExtension method

String tryAppendExtension (String path, String ext)

Append a ext extension to path if appropriate.

Implementation

String tryAppendExtension(String path, String ext) {
  final RegExp re = RegExp(r'(\.[a-z]*$)|([\?;].*)$');
  return re.hasMatch(path) ? path : '$path$ext';

//2.4.0 20150226
//  abstractFileManager.prototype.tryAppendExtension = function(path, ext) {
//      return /(\.[a-z]*$)|([\?;].*)$/.test(path) ? path : path + ext;
//  };
}