mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Filesystem: Include '.' and '..' in directory iteration
The standard is intentionally vague on if filesystems must have '.' and '..' entries, allowing filesystems to omit this concept completely: http://pubs.opengroup.org/onlinepubs/9699919799/functions/readdir.html However, the '.' and '..' entries are common on FAT filesystems and in most other filesystems. This enables '.' and '..' entries in the FAT filesystem.pull/4186/head
							parent
							
								
									65adf446c5
								
							
						
					
					
						commit
						fd80dcc51b
					
				| 
						 | 
				
			
			@ -116,7 +116,13 @@ void test_read_dir() {
 | 
			
		|||
    while ((de = readdir(&dir))) {
 | 
			
		||||
        printf("d_name: %.32s, d_type: %x\n", de->d_name, de->d_type);
 | 
			
		||||
 | 
			
		||||
        if (strcmp(de->d_name, "test_dir") == 0) {
 | 
			
		||||
        if (strcmp(de->d_name, ".") == 0) {
 | 
			
		||||
            test_dir_found = true;
 | 
			
		||||
            TEST_ASSERT_EQUAL(DT_DIR, de->d_type);
 | 
			
		||||
        } else if (strcmp(de->d_name, "..") == 0) {
 | 
			
		||||
            test_dir_found = true;
 | 
			
		||||
            TEST_ASSERT_EQUAL(DT_DIR, de->d_type);
 | 
			
		||||
        } else if (strcmp(de->d_name, "test_dir") == 0) {
 | 
			
		||||
            test_dir_found = true;
 | 
			
		||||
            TEST_ASSERT_EQUAL(DT_DIR, de->d_type);
 | 
			
		||||
        } else if (strcmp(de->d_name, "test_file") == 0) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -126,7 +126,7 @@
 | 
			
		|||
/  When _LFN_UNICODE is 0, this option has no effect. */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define _FS_RPATH	0
 | 
			
		||||
#define _FS_RPATH	1
 | 
			
		||||
/* This option configures relative path feature.
 | 
			
		||||
/
 | 
			
		||||
/   0: Disable relative path feature and remove related functions.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue