|
From: Joshua J. <jj...@gm...> - 2009-05-28 23:28:17
|
Suppressing all dotfiles is overkill. It's perfectly valid for a
user to create or rename a file so it begins with a dot, and various
programs use dotfiles for their own purposes.
Also, the means to write Mac apps that don't inadvertently open
drivers (FSpOpenDF()) has been available for two decades.
Index: extfs.cpp
===================================================================
RCS file: /home/cvs/cebix/BasiliskII/src/extfs.cpp,v
retrieving revision 1.36
diff -u -r1.36 extfs.cpp
--- extfs.cpp 20 Jun 2008 00:39:47 -0000 1.36
+++ extfs.cpp 28 May 2009 23:18:54 -0000
@@ -1245,6 +1245,18 @@
return (int16)r.d[0];
}
+static bool is_dot_or_dotdot( const char* name )
+{
+ if ( name[0] == '.' )
+ {
+ const bool dotdot = name[1] == '.';
+
+ return name[ 1 + dotdot ] == '\0';
+ }
+
+ return false;
+}
+
// Query file attributes (HFileParam)
static int16 fs_get_file_info(uint32 pb, bool hfs, uint32 dirID)
{
@@ -1283,7 +1295,7 @@
closedir(d);
return fnfErr;
}
- if (de->d_name[0] == '.')
+ if (is_dot_or_dotdot(de->d_name))
goto read_next_de; // Suppress names beginning with '.' (MacOS
could interpret these as driver names)
//!! suppress directories
}
@@ -1406,7 +1418,7 @@
closedir(d);
return fnfErr;
}
- if (de->d_name[0] == '.')
+ if (is_dot_or_dotdot(de->d_name))
goto read_next_de; // Suppress names beginning with '.' (MacOS
could interpret these as driver names)
}
add_path_comp(de->d_name);
@@ -1465,7 +1477,7 @@
de = readdir(d);
if (de == NULL)
break;
- if (de->d_name[0] == '.')
+ if (is_dot_or_dotdot(de->d_name))
continue; // Suppress names beginning with '.'
count++;
}
|