From 51d6b9eeeabf4c33317a8eebfb6eb65c12c34f79 Mon Sep 17 00:00:00 2001 From: debris Date: Tue, 9 Aug 2016 14:10:01 +0200 Subject: [PATCH] fixed #1889, .DS_Store is no longer treated as key file --- ethstore/src/dir/disk.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ethstore/src/dir/disk.rs b/ethstore/src/dir/disk.rs index d48fa1b589d..974f7a3c283 100644 --- a/ethstore/src/dir/disk.rs +++ b/ethstore/src/dir/disk.rs @@ -22,6 +22,8 @@ use ethkey::Address; use {json, SafeAccount, Error}; use super::KeyDirectory; +const IGNORED_FILES: &'static [&'static str] = &[".DS_Store"]; + #[cfg(not(windows))] fn restrict_permissions_to_owner(file_path: &Path) -> Result<(), i32> { use std::ffi; @@ -62,7 +64,9 @@ impl DiskDirectory { .flat_map(Result::ok) .filter(|entry| { let metadata = entry.metadata(); - metadata.is_ok() && !metadata.unwrap().is_dir() + let file_name = entry.file_name(); + metadata.is_ok() && !metadata.unwrap().is_dir() && + !IGNORED_FILES.contains(&file_name.to_str().unwrap()) }) .map(|entry| entry.path()) .collect::>();