You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,13 @@ This is a library for dealing with File I/O on .NET that overcomes some limitati
4
4
5
5
It was created to factor out some of the file-system specific features that have built up in the [LessMSI project](https://github.com/activescott/lessmsi).
6
6
7
+
7
8
Goals
8
9
========
9
10
* Support File I/O operations on Windows that .NET's System.IO libraries fail to support such as long paths (those longer than 260 characters).
10
11
* Provide a basis for platform independent file system access across both Windows and Unix-like systems such as Linux and Mac OSX, and potentially others (cloud file storage?).
11
12
13
+
12
14
Concepts & Usage
13
15
========
14
16
Two concepts are necessary to use the library `FileSystem` and `Path`. The static `FileSystem` class is a static class that contains all of the operations available on the `FileSystem`. Any operation that has a path argument, such as `FileSystem.CreateDirectory`, accepts paths as strongly typed `Path` objects rather than strings. For example,
@@ -20,10 +22,11 @@ Having paths strongly typed rather than strings forces the caller to be more exp
20
22
21
23
new Path(@"c:\src\\lessmsi") == new Path(@"c:\src\lessmsi") // true
22
24
23
-
`Path` has some handy shortcuts on it too such as Remove (delete) that calls back into the FileSystem to remove the file or directory at the current path:
25
+
`Path` has some handy shortcuts on it too such as Exists that calls back into the FileSystem to determine if the file or directory at the current path already exists.
26
+
These methods also provides some compatibility with existing code using System.IO.FileInfo or System.IO.DirectoryInfo so that in many cases you can replace usage of System.IO.FileInfo/DirectoryInfo with LessIO.Path.
24
27
25
28
Path destDir = new Path(@"c:\src\lessmsi");
26
-
destDir.Remove();
29
+
Console.WriteLine(destDir.Exists);
27
30
28
31
`Path` also offers some of the commonly used static methods on System.IO.Path to make the type relatively compatible with existing code using System.IO.Path. For example, `Combine` and `GetFileName` are available to make porting System.IO code easier:
29
32
@@ -34,3 +37,10 @@ Having paths strongly typed rather than strings forces the caller to be more exp
34
37
Platform Independence
35
38
========
36
39
The current implementation supports Win32 via the [Win32FileSystemStrategy.cs](https://github.com/activescott/LessIO/blob/master/src/LessIO/Strategies/Win32/Win32FileSystemStrategy.cs). However, adding support for another file system such as a Unixy file system could be done by implementing the ~10 methods on a class derived from [FileSystemStrategy](https://github.com/activescott/LessIO/blob/master/src/LessIO/Strategies/FileSystemStrategy.cs) and then updating the implementation of [FileSystem.LazyStrategy](https://github.com/activescott/LessIO/blob/master/src/LessIO/FileSystem.cs).
40
+
41
+
42
+
Contributing
43
+
========
44
+
We accept pull requests! I think this is a sound basis, but obviously there are many improvements that could be made such as [improving platform independence by adding a new FileSystemStrategy](#platform-independence) or adding more static methods to [Path](https://github.com/activescott/LessIO/blob/master/src/LessIO/Path.cs) from System.IO.FileInfo/DirectoryInfo to make it easier to port System.IO code over to this library. There might also be some important methods missing on [FileSystem](https://github.com/activescott/LessIO/blob/master/src/LessIO/FileSystem.cs) as I just added the operations that [LessMSI](https://github.com/activescott/LessMSI) already uses which I imagine is fairly extensive but maybe not comprehensive.
45
+
46
+
Please do make sure that existing tests pass and please add new ones for the new features you write.
0 commit comments