Commit Graph
61 Commits
Author SHA1 Message Date
Marek Safar 1242b4b82c [corlib] Enumerate all subdirectories including the first one. Fixes #22857 2014-09-11 11:20:44 +02:00
Rodrigo Kumpera 1b92a4148c Since MOBILE implies NET_4_* now, take this into account and simplify our ifdefs. 2013-02-11 18:42:18 -05:00
Rodrigo Kumpera b96d05dac3 Kill the MOONLIGHT define in corlib. 2013-02-11 16:03:28 -05:00
Rodrigo Kumpera 089ab9c975 DirectoryInfo should update its internal values when MoveTo is called. Fixes #7653. 2013-01-11 16:23:37 -05:00
Marek Safar c133ae2dc8 Merge pull request #485 from mtausig/master
Bugfix for DirectoryInfo.GetDirectories()
2012-10-29 09:49:43 -07:00
mtausig a67abaf7d3 Fix: Removed wrong increment 2012-10-29 16:50:35 +01:00
mtausig 852718b499 Removed null check of parameter (done in Directory.GetDirectories)
Changed foreach loop to for loop
Added some comments
2012-10-29 13:29:24 +01:00
mtausig 9918be57fe Removed extra-brace 2012-10-29 11:06:14 +01:00
James Bellinger 9322e0d16b ACLs now work on Windows. Tests all the way up to DirectorySecurityTest and FileSecurityTest.
NativeObjectSecurity is implemented.
I've done it in such a way that, for OSes that do not have a unified API for all ACLs,
overrides can be done in subclasses such as FileSystemSecurity without trouble.

ObjectSecurity, CommonObjectSecurity, and DirectoryObjectSecurity all implemented.
MutexSecurity, PipeSecurity, etc. all just add type specialization and nothing else. Implemented all of these as well.

Access and Audit rules now correctly use NTAccount in their string overloads (see unit tests).
The constructors all provide correct AccessMasks now. In other words, these classes are all now un-broken/no longer stubs.

More unit tests for CommonSecurityDescriptor and fixes to pass them.
A few had checks that were redundant (implemented by (Authorization|Audit|Access)Rule) as well. These have been removed.
The Allow Everyone Full Access default for null DiscretionaryAcls in CommonSecurityDescriptor is, I think,
properly implemented. This required some changes to GenericSecurityDescriptor as well, but now Mono matches
MS.NET on GetSddl/GetBinaryForm for null DiscretionaryAcl including roundtrip.

What's still missing:
(1) CommonAcl's RemoveAccess/RemoveAudit. RemoveAll and RemoveSpecific work so it's not a big issue.
(2) CommonAcl merging will not yet try to merge a CommonAce together with an ObjectAce.
(3) The various *Security constructors. Get/SetAccessControl work on files and directories.
However, you still have to create and then set. I am not too familiar with Mono runtime internal
calls, but to someone who is: If the SECURITY_ATTRIBUTES parameter to Create*'s lpSecurityDescriptor
pointed to the output of GenericSecurityDescriptor's GetBinaryForm, that would be a complete
implementation.
2012-07-07 18:45:06 -04:00
Marek Safar c40620bc21 Add missing null check to Directory enumerators 2012-03-19 17:15:49 +00:00
mtausig 42fad922f5 Update mcs/class/corlib/System.IO/DirectoryInfo.cs 2012-03-07 12:58:29 +01:00
Geoff Norton 16d4fd790b Further .NET 4.0 ification of the mobile profile 2011-01-25 20:10:54 -05:00
Sebastien Pouliot e6fd69e444 2010-04-16 Sebastien Pouliot <[email protected]>
* Directory.cs: Ensure elevated trust when calling on 
	Moonlight.
	* DirectoryInfo.cs: Ensure elevated trust when calling a .ctor 
	on Moonlight.
	* File.cs: Ensure elevated trust when calling a .ctor on 
	Moonlight.
	* FileInfo.cs: Ensure elevated trust when calling a .ctor on 
	Moonlight.
	* FileStream.cs: Ensure elevated trust when calling a .ctor on 
	Moonlight. Name property returns "[Unknown]" unless a Moonlight
	application is executed with elevated trust.
	* Path.cs: Ensure elevated trust when calling a GetTempPath,
	GetTempFileName or GetFullPath on Moonlight. Add a shared 
	internal method to validate paths to reduce code duplication.


svn path=/trunk/mcs/; revision=155643
2010-04-16 17:29:07 +00:00
Sebastien Pouliot c02f14af40 2010-03-29 Sebastien Pouliot <[email protected]>
* DirectoryInfo.cs, FileInfo.cs: Moonlight needs the default ctor
	to decorate them with [SecuritySafeCritical] for corclr 
	inheritance rules


svn path=/trunk/mcs/; revision=154364
2010-03-29 11:56:03 +00:00
Sebastien Pouliot 5012b755ff 2010-03-22 Sebastien Pouliot <[email protected]>
* Directory.cs, DirectoryInfo.cs: Disble new NET_4_0 API used in
	SL4 until we have elevated trust working correctly (since they 
	are *not* decorated as [SecurityCritical])


svn path=/trunk/mcs/; revision=153968
2010-03-22 11:53:14 +00:00
Jb Evain 05a5b21fa0 use MOONLIGHT symbol
svn path=/trunk/mcs/; revision=153656
2010-03-16 12:10:19 +00:00
Rolf Bjarne Kvinge f66b3edf96 2010-03-16 Rolf Bjarne Kvinge <[email protected]>
* Path.cs:
	* Directory.cs:
	* DirectoryInfo.cs: Add some of the 4.0 methods to Moonlight.

svn path=/trunk/mcs/; revision=153650
2010-03-16 10:47:36 +00:00
Gonzalo Paniagua Javier a5494a7e91 2010-01-25 Gonzalo Paniagua Javier <[email protected]>
* DirectoryInfo.cs: new overload for GetFileSystemInfos().


svn path=/trunk/mcs/; revision=150164
2010-01-26 00:13:15 +00:00
Miguel de Icaza 285e89d96a Add new overloads
svn path=/trunk/mcs/; revision=146707
2009-11-23 07:22:20 +00:00
Geoff Norton 32555b5234 restore some types to MT
svn path=/trunk/mcs/; revision=144324
2009-10-18 16:55:11 +00:00
Miguel de Icaza 0204abe803 Drop more obsolete defines
svn path=/trunk/mcs/; revision=144304
2009-10-17 01:35:27 +00:00
Sebastien Pouliot ada00d32ed 2009-09-23 Sebastien Pouliot <[email protected]>
* Directory.cs: Don't expose SearchOption in NET_2_1
	* DirectoryInfo.cs: Don't expose SearchOption in NET_2_1
	* MonoIO.cs: Don't throw a DriveNotFoundException under NET_2_1 -
	an IOExpection will be thrown (like the 1.x profile)


svn path=/trunk/mcs/; revision=142479
2009-09-23 12:41:59 +00:00
Sebastien Pouliot 2203a2bb29 2009-09-18 Sebastien Pouliot <[email protected]>
* Directory.cs: Avoid imperative CAS checks and remove 
	AccessControl types for NET_2_1
	* DirectoryInfo.cs: Remove AccessControl types for NET_2_1
	* File.cs: Remove AccessControl types for NET_2_1
	* FileInfo.cs: Remove AccessControl types for NET_2_1
	* FileStream.cs: Remove AccessControl types for NET_2_1
	* Path.cs: Avoid imperative CAS checks for NET_2_1


svn path=/trunk/mcs/; revision=142197
2009-09-18 15:57:32 +00:00
Gonzalo Paniagua Javier 93e506d40e 2009-09-17 Gonzalo Paniagua Javier <[email protected]>
* DirectoryInfo.cs: throw if FullPath is not a directory.
	Fixes bug #539791.


svn path=/trunk/mcs/; revision=142092
2009-09-17 04:36:06 +00:00
Andreas N 3df89d4a6d 2008-06-30 Andreas Nahr <[email protected]>
* BinaryReader.cs: Fix parameter names
	* BinaryWriter.cs: Fix parameter names, fix exceptions
	* BufferedStream.cs: Fix parameter names
	* Directory.cs: Fix parameter names, fix exceptions, optimize == "" cases
	* DirectoryInfo.cs:
	* DirectoryNotFoundException.cs:
	* FileNotFoundException.cs:
	* FileStream.cs: Fix parameter names, fix exceptions
	* IOException.cs: Fix parameter names

svn path=/trunk/mcs/; revision=106943
2008-06-30 23:02:31 +00:00
Gert Driesen 5d4e8d2ce4 * DirectoryInfo.cs: Added new internal ctor, which takes a bool that
indicates whether the original path should only container the last
part of the directory. Moved logic for determining the Name and
Parent to Initialize method, to allow it to be re-used on
deserialization. Renamed argument names to fix corcompare issues.
Added missing argument checks.
* Directory.cs (CreateDirectoriesInternal): Use internal ctor for
DirectoryInfo to ensure OriginalPath only contains last part of
the directory.
* File.cs: Removed redundant checks from Create. On 2.0 profile, pass
FileOptions to FileStream. Removed redundant directory check from
Delete and modified exceptions to more closely match MS.
* FileInfo.cs: Added argument check to ctor to match MS. Added missing
deserialization ctor. Modified argument checks in MoveTo, and removed
redundant checks. Added missing argument checks in CopyTo. Code
formatting.
* FileSystemInfo.cs: Modified argument checks in CheckPath to more
closely match MS.
* MonoIO.cs: Added msg that does not disclose filename for
ERROR_FILE_EXISTS.
* Path.cs: Use String.Length instead of comparing with String.Empty.
Removed exceptions argument names to match MS.
* File.cs: Added/improved tests for Create and Move.
* DirectoryInfoTest.cs: No longer derive from deprecated Assertion
class. Improved tests for ctor, Create, Name, Parent, ...
* FileInfoTest.cs: No longer derive from deprecated Assertion class.
Improved/added tests, 
* PathTest.cs: Added tests for IsPathRooted and GetFullPath.
* FileSystemInfoTest.cs: Fixed test. Now passes on both Mono and MS.

svn path=/trunk/mcs/; revision=101006
2008-04-17 15:04:25 +00:00
Gert Driesen 9770502338 * File.cs: Changed argument names and thrown exception to better match
.NET. Use String.Length instead of comparison with empty string.
* DirectoryInfo.cs: Added missing deserialization ctor.
* FileTest.cs: Renamed and improved existing tests. Avoid use of
ExpectedException.
* FileSystemInfoTest.cs: No longer derive from deprecated Assertion
class. Added (de)serialization tests.

svn path=/trunk/mcs/; revision=100870
2008-04-16 14:01:25 +00:00
Eyal Alalouf fbd34a95a9 Use MonoNotSupported & MonoLimitation attribute to tag that DirectorySecurity is not supported.
svn path=/trunk/mcs/; revision=73302
2007-02-22 10:25:25 +00:00
Miguel de Icaza 3a23274a17 Revert Patch 72756 until we review and discuss this publicly
svn path=/trunk/mcs/; revision=72768
2007-02-13 13:07:41 +00:00
Boris Kirzner 04052b1827 Path handling fixes in File, Directory and Path including windows-specific negative flows.
svn path=/trunk/mcs/; revision=72756
2007-02-13 12:04:32 +00:00
Miguel de Icaza d3b0757c7d 2007-01-22 Miguel de Icaza <[email protected]>
* DirectoryInfo.cs: Throw a better exception (accorind go the
	docs, UnauthorizedAccessException is thrown if the underlying
	platform does not support it and *also* if there are no
	permissions to access it, which is more convenient than the
	PlatformNotSupportedException that only states that it needs Win2k
	or newer).

svn path=/trunk/mcs/; revision=71457
2007-01-22 20:16:08 +00:00
Miguel de Icaza 8a1af5fd38 2006-11-16 Miguel de Icaza <[email protected]>
* DirectoryInfo.cs (GetFiles): Implement option with SearchOptions
	== AllDirectories

And a lot of MonoTODOs updated as well


svn path=/trunk/mcs/; revision=67998
2006-11-16 14:14:01 +00:00
Miguel de Icaza 8542fc04b6 2006-10-30 Joel Reed <[email protected]>
* NameValueConfigurationCollection.cs: Implement the Properties
	property. 

2006-10-30 Joel Reed  <[email protected]>

	* DirectoryInfo.cs: Implement SearchOption.AllDirectories option.


2006-10-30  <[email protected]>

	* DirectoryInfoTest.cs: Updated tests to support the DirectoryInfo
	SearchOption.AllDirectories

svn path=/trunk/mcs/; revision=67150
2006-10-30 21:01:02 +00:00
Atsushi Eno c671eb6c68 2006-01-18 Atsushi Enomoto <[email protected]>
* DirectoryInfo.cs : on Windows top directory is something like c:\.

	* DirectoryInfoTest.cs : don't expect "/" as a top directory on
	  Windows.


svn path=/trunk/mcs/; revision=55707
2006-01-18 08:07:28 +00:00
Sebastien Pouliot 77bd1f47fc 2005-12-23 Sebastien Pouliot <[email protected]>
* DirectoryInfo.cs: Fixed #77090 to fix /home parent to be / (and not
	null).


svn path=/trunk/mcs/; revision=54794
2005-12-23 20:20:11 +00:00
Sebastien Pouliot 90e63868d2 2005-12-15 Sebastien Pouliot <[email protected]>
* DirectoryInfo.cs: Fixed #76903 where the Name property wasn't 
	correct in some cases. Added special case for Windows drives. Reduced
	temporary allocations in Get* methods (removed ArrayList). Added some
	new 2.0 methods (partial).
	* MonoIO.cs: Removed InvalidPathChars icall as the return value is 
	different from 1.x and 2.0. The values are now defined in Path.cs.
	* Path.cs: Fixed #76191 so that GetFullPath on a Windows drive returns
	the current directory (if it's on the specified drive). Fixed 2.0 API
	changes (e.g. static class).
	* SearchOption.cs: Added missing [Serializable] (2.0).


svn path=/trunk/mcs/; revision=54456
2005-12-15 14:29:34 +00:00
Dick Porter 3518c73d6c 2005-11-10 Dick Porter <[email protected]>
* DirectoryInfo.cs: Fix endless recursion problem with root
        directory on windows too.  Fixes bug 76191.



svn path=/trunk/mcs/; revision=52853
2005-11-10 16:22:29 +00:00
Sebastien Pouliot ca4dfd5125 2005-07-04 Sebastien Pouliot <[email protected]>
* DirectoryInfo.cs: Fixed recursion problem with root directory 
	introduced when fixing bug #75443.


svn path=/trunk/mcs/; revision=46910
2005-07-04 16:59:47 +00:00
Sebastien Pouliot 62b7171499 2005-07-02 Sebastien Pouliot <[email protected]>
* FileSystemInfo.cs: Fixed exception arguments. Added ComVisible for
	NET_2_0.
	* DirectoryInfo.cs: Fixed bug #75443 when the directory ends with a
	separator. Added ComVisible for NET_2_0. Normalized line endings.


svn path=/trunk/mcs/; revision=46879
2005-07-02 15:28:45 +00:00
Ben Maurer 050befc708 In Test/System.IO:
2004-12-04  Ben Maurer  <[email protected]>

	* DirectoryInfoTest.cs: Check for CreateSubdirectory with empty string.

In System.IO:
2004-12-04  Ben Maurer  <[email protected]>

	* DirectoryInfo.cs (CreateSubDirectory): Check the input here.
	
	* FileSystemInfo.cs (CheckPath): Empty paths are invalid.


svn path=/trunk/mcs/; revision=37135
2004-12-05 02:38:06 +00:00
Duncan Mak 13d1764537 Add license and copyright to all source files in corlib
svn path=/trunk/mcs/; revision=29249
2004-06-11 02:09:36 +00:00
Atsushi Eno 7e8678f8c6 2004-05-26 Atsushi Enomoto <[email protected]>
* FileInfo.cs,
	  DirectoryInfo.cs : ToString() should return constructor arg as is.
	  This fixes bug #58804.

svn path=/trunk/mcs/; revision=28120
2004-05-26 03:54:51 +00:00
Duncan Mak adac222648 * DirectoryInfo.cs:
* FileInfo.cs: Reformat the whole file to use DOS line endings.
(MoveTo): Return if the destination of Move is the same as the file's
current location.

svn path=/trunk/mcs/; revision=27996
2004-05-24 19:49:18 +00:00
Jackson Harper 9c7aa8ac9c * DirectoryInfo.cs: Create subdirectories correctly if more then
one is supplied.

svn path=/trunk/mcs/; revision=27785
2004-05-20 23:59:46 +00:00
Atsushi Eno 8fb3d716a6 2004-05-16 Atsushi Enomoto <[email protected]>
* DirectoryInfo.cs: Fixed ToString() as well as FileInfo.

svn path=/trunk/mcs/; revision=27482
2004-05-16 15:02:47 +00:00
Gonzalo Paniagua Javier b9b627fbcd 2003-11-12 Gonzalo Paniagua Javier <[email protected]>
* DirectoryInfo.cs: fixed ToString. Closes bug #50842.

svn path=/trunk/mcs/; revision=19891
2003-11-12 15:45:36 +00:00
Gonzalo Paniagua Javier 923769916a 2003-05-14 Gonzalo Paniagua Javier <[email protected]>
* DirectoryInfo.cs: fixed bug #42991.
	* Path.cs:
	(CanonicalizePath): store the value of the trimmed input string. Make it
	work with paths such as "/home/xxx/.".

svn path=/trunk/mcs/; revision=14585
2003-05-14 18:30:11 +00:00
Ville Palo aa71caf8c6 2003-05-06 Ville Palo <[email protected]>
* BufferedStream.cs:
	  - Removed unusefull code.
	  - Added ObjectDisposedException to Position
	  - Dont flush if stream is allready closed.
	  - Flush throws also ObjectDisposedException.
	* Directory.cs:
	  - GetFileSystemEtries: ArgumentNullException if pattern is null
	* DirectoryInfo.cs: Fixed little MoveTo () bug.
	* FileInfo.cs:
	  - Exists: If file does not exists when instance is created the
	  value of the Exists property does not change even if file is created
	  afterwards.
	  - Delete: If path is a directory UnauthorizedException is thrown.
	  - CopyTo: Now we can overwrite file if wanted.
	* Path.cs:
	  - GetFullPath: Now throws exception when path is "   ".

svn path=/trunk/mcs/; revision=14370
2003-05-07 14:43:29 +00:00
Gonzalo Paniagua Javier 1727ec736b 2003-03-03 Gonzalo Paniagua Javier <[email protected]>
* Directory.cs:
	(Move): don't use File.Move.

	* DirectoryInfo.cs: fixed Name property.

	Fixes bug #37755.

svn path=/trunk/mcs/; revision=12116
2003-03-03 10:33:05 +00:00
Gonzalo Paniagua Javier 875ad2454d 2003-03-02 Gonzalo Paniagua Javier <[email protected]>
* DirectoryInfo.cs: changed ToString to match MS behavior.
	* Path.cs: further fixes to GetDirectoryName to return null in the
	same cases that MS does.

	Fixes bug #38387.

svn path=/trunk/mcs/; revision=12105
2003-03-02 17:18:51 +00:00