Debian Codegraph @

extern/igfd/dirent/README.md

raw
1 # Dirent
2 Dirent is a C/C++ programming interface that allows programmers to retrieve
3 information about files and directories under Linux/UNIX. This project
4 provides Linux compatible Dirent interface for Microsoft Windows.
5
6
7 # Installation
8
9 Download the latest Dirent installation package from
10 [GitHub](https://github.com/tronkko/dirent/releases) and
11 unpack the installation file with 7-zip, for example. The installation
12 package contains dirent.h file as well as a few example programs and
13 tests.
14
15
16 ## Install Dirent for All Programs
17
18 To make dirent.h available for all C/C++ programs, simply copy the
19 ``include/dirent.h`` file to the system include directory. System include
20 directory contains header files such as assert.h and windows.h. In Visual
21 Studio 2008, for example, the system include may be found at
22 ``C:\Program Files\Microsoft Visual Studio 9.0\VC\include``.
23
24 Everything you need is included in the single dirent.h file, and you can
25 start using Dirent immediately -- there is no need to add files to your
26 Visual Studio project.
27
28
29 ## Embed Dirent into Your Own Project
30
31 If you wish to distribute dirent.h alongside with your own source code, then
32 copy ``include/dirent.h`` file to a new sub-directory within your project and
33 add that directory to include path on Windows while omitting the directory
34 under Linux/UNIX. This allows your project to be compiled against native
35 dirent.h on Linux/UNIX while substituting the functionality on Microsoft
36 Windows.
37
38
39 ## Examples
40
41 The installation package contains four example programs:
42
43 Program | Purpose
44 -------- | -----------------------------------------------------------------
45 ls | List files in a directory, e.g. ls "c:\Program Files"
46 find | Find files in subdirectories, e.g. find "c:\Program Files\CMake"
47 updatedb | Build database of files in a drive, e.g. updatedb c:\
48 locate | Locate a file from database, e.g. locate notepad.exe
49
50 To build the example programs, first install [CMake](https://cmake.org/).
51 Then, with CMake installed, open command prompt and create a temporary
52 directory ``c:\temp\dirent`` for the build files as
53
54 ```
55 c:\
56 mkdir temp
57 mkdir temp\dirent
58 cd temp\dirent
59 ```
60
61 Generate build files as
62
63 ```
64 cmake d:\dirent
65 ```
66
67 where ``d:\dirent`` is the root directory of the Dirent package (containing
68 this README.md and LICENSE file).
69
70 Once CMake is finished, open Visual Studio, load the generated dirent.sln file
71 from the build directory and build the solution. Once the build completes, run
72 the example programs from the command prompt as
73
74 ```
75 cd Debug
76 ls .
77 find .
78 updatedb c:\
79 locate cmd.exe
80 ```
81
82
83 # Copying
84
85 Dirent may be freely distributed under the MIT license. See the
86 [LICENSE](LICENSE) file for details.
87
88
89 # Alternatives to Dirent
90
91 I ported Dirent to Microsoft Windows in 1998 when only a few alternatives
92 were available. However, the situation has changed since then and nowadays
93 both [Cygwin](http://www.cygwin.com) and [MingW](http://www.mingw.org)
94 allow you to compile a great number of UNIX programs in Microsoft Windows.
95 They both provide a full dirent API as well as many other UNIX APIs. MingW
96 can even be used for commercial applications!