Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't write LFN entries for "." and ".." #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions embedded-fatfs/src/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,15 @@ impl<'a, IO: ReadWriteSeek, TP: TimeProvider, OCC: OemCpConverter> Dir<'a, IO, T
validate_long_name(name)?;
// convert long name to UTF-16
let lfn_utf16 = Self::encode_lfn_utf16(name);
// write LFN entries
let (mut stream, start_pos) = self.alloc_and_write_lfn_entries(&lfn_utf16, raw_entry.name()).await?;
let (mut stream, start_pos) = if name == "." || name == ".." {
// skip LFN entries for "." and ".." and only find space 1 SFN entry
let mut stream = self.find_free_entries(1).await?;
let start_pos = stream.seek(io::SeekFrom::Current(0)).await?;
(stream, start_pos)
} else {
// write LFN entries
self.alloc_and_write_lfn_entries(&lfn_utf16, raw_entry.name()).await?
};
// write short name entry
raw_entry.serialize(&mut stream).await?;
// Get position directory stream after entries were written
Expand Down
Loading