rust/hg-core/src/utils/files.rs
changeset 42840 b1b984f9c01d
parent 42751 4b3b27d567d5
child 42957 7a01778bc7b7
--- a/rust/hg-core/src/utils/files.rs	Wed Aug 28 08:16:58 2019 -0400
+++ b/rust/hg-core/src/utils/files.rs	Thu Aug 22 14:31:07 2019 +0200
@@ -71,6 +71,15 @@
     dirs
 }
 
+/// TODO improve handling of utf8 file names. Our overall strategy for
+/// filenames has to be revisited anyway, since Windows is UTF-16.
+pub fn normalize_case(bytes: &[u8]) -> Vec<u8> {
+    #[cfg(windows)] // NTFS compares via upper()
+    return bytes.to_ascii_uppercase();
+    #[cfg(unix)]
+    bytes.to_ascii_lowercase()
+}
+
 #[cfg(test)]
 mod tests {
     #[test]