Index: sdk/lib/io/file_system_entity.dart |
diff --git a/sdk/lib/io/file_system_entity.dart b/sdk/lib/io/file_system_entity.dart |
index af28044defe6b3c6dc0e4dec6cbfe7993c268550..d35efc5c1b264841e8cee149c91138de5d6de104 100644 |
--- a/sdk/lib/io/file_system_entity.dart |
+++ b/sdk/lib/io/file_system_entity.dart |
@@ -622,6 +622,22 @@ abstract class FileSystemEntity { |
} |
return path; |
} |
+ |
+ static String _ensureTrailingPathSeparators(String path) { |
+ // Don't handle argument errors here. |
+ if (path is! String) return path; |
+ if (path.isEmpty) path = '.'; |
+ if (Platform.operatingSystem == 'windows') { |
+ while (!path.endsWith(Platform.pathSeparator) && !path.endsWith('/')) { |
+ path = "$path${Platform.pathSeparator}"; |
+ } |
+ } else { |
+ while (!path.endsWith(Platform.pathSeparator)) { |
+ path = "$path${Platform.pathSeparator}"; |
+ } |
+ } |
+ return path; |
+ } |
} |