[Slim-Checkins] r12514 - /trunk/server/Slim/Utils/Misc.pm

mherger at svn.slimdevices.com mherger at svn.slimdevices.com
Thu Aug 9 03:03:54 PDT 2007


Author: mherger
Date: Thu Aug  9 03:03:53 2007
New Revision: 12514

URL: http://svn.slimdevices.com?rev=12514&view=rev
Log:
Bug: n/a
Description: hide hidden & system files and folders on Windows

Modified:
    trunk/server/Slim/Utils/Misc.pm

Modified: trunk/server/Slim/Utils/Misc.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Utils/Misc.pm?rev=12514&r1=12513&r2=12514&view=diff
==============================================================================
--- trunk/server/Slim/Utils/Misc.pm (original)
+++ trunk/server/Slim/Utils/Misc.pm Thu Aug  9 03:03:53 2007
@@ -64,11 +64,11 @@
 	if ($^O =~ /Win32/) {
 		require Win32;
 		require Win32::API;
-		require Win32::File;
 		require Win32::FileOp;
 		require Win32::Process;
 		require Win32::Service;
 		require Win32::Shortcut;
+		use Win32::File qw(GetAttributes HIDDEN SYSTEM);
 	}
 }
 
@@ -857,12 +857,21 @@
 
 		my $fullpath = catdir($dirname, $item);
 
+		# Don't display hidden/system files on Windows
+		if (Slim::Utils::OSDetect::OS() eq "win") {
+			my $attributes;
+			GetAttributes($fullpath, $attributes);
+			next if ($attributes & HIDDEN) || ($attributes & SYSTEM);
+		}
+
+
 		# We only want files, directories and symlinks Bug #441
 		# Otherwise we'll try and read them, and bad things will happen.
 		# symlink must come first so an lstat() is done.
 		unless (-l $fullpath || -d _ || -f _) {
 			next;
 		}
+
 
 		# Don't bother with file types we don't understand.
 		if ($validRE && -f _) {



More information about the checkins mailing list