mirror of
https://github.com/ankitects/anki.git
synced 2025-12-15 07:40:58 -05:00
restrict case-folding to windows
This commit is contained in:
parent
a929a133d6
commit
aad01d904f
1 changed files with 7 additions and 3 deletions
|
|
@ -21,10 +21,14 @@ pub mod changetracker;
|
||||||
pub struct Checksums(HashMap<String, Sha1Hash>);
|
pub struct Checksums(HashMap<String, Sha1Hash>);
|
||||||
|
|
||||||
impl Checksums {
|
impl Checksums {
|
||||||
// case-fold filenames when checking files to be imported
|
|
||||||
// to account for case-insensitive filesystems
|
|
||||||
pub fn get(&self, key: impl AsRef<str>) -> Option<&Sha1Hash> {
|
pub fn get(&self, key: impl AsRef<str>) -> Option<&Sha1Hash> {
|
||||||
self.0.get(key.as_ref().to_lowercase().as_str())
|
if cfg!(windows) {
|
||||||
|
// case-fold filenames when checking files to be imported
|
||||||
|
// to account for case-insensitive filesystems
|
||||||
|
self.0.get(key.as_ref().to_lowercase().as_str())
|
||||||
|
} else {
|
||||||
|
self.0.get(key.as_ref())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn contains_key(&self, key: impl AsRef<str>) -> bool {
|
pub fn contains_key(&self, key: impl AsRef<str>) -> bool {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue