win32-dir 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGES +121 -116
- data/MANIFEST +10 -8
- data/README +273 -273
- data/Rakefile +34 -38
- data/certs/djberg96_pub.pem +21 -0
- data/examples/dir_example.rb +22 -22
- data/lib/win32-dir.rb +1 -0
- data/lib/win32/dir.rb +417 -417
- data/lib/win32/dir/constants.rb +26 -26
- data/lib/win32/dir/functions.rb +66 -66
- data/lib/win32/dir/structs.rb +37 -37
- data/test/test_win32_dir.rb +466 -466
- data/win32-dir.gemspec +30 -29
- metadata +28 -4
- metadata.gz.sig +2 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fa2671864fff6d5baf15a94c38d5d49066c2a2f
|
4
|
+
data.tar.gz: c036f3097b86f3f178da31c4105d71f44a7b22b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b55fc21bbba08fae66acddec7c5b635c717b3c38f8aec3726f20f68491b9c4e502ad904405f938ccc174caa0a3eff43b664c0aab2ce0aa63299c569ceb63f350
|
7
|
+
data.tar.gz: d029bbc35525ab75ea5d6afaf02e5a02233e3feb0cf56aa4b42bed668c50d856e8d6c2bbe00e5b31aa401bc2eb5a3c1ef225714e612a8090548466a95551290b
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/CHANGES
CHANGED
@@ -1,116 +1,121 @@
|
|
1
|
-
== 0.5.
|
2
|
-
*
|
3
|
-
|
4
|
-
*
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
*
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
*
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
== 0.4.
|
36
|
-
*
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
== 0.4.
|
41
|
-
* Yet another encoding fix
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
*
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
*
|
66
|
-
|
67
|
-
*
|
68
|
-
|
69
|
-
== 0.3.
|
70
|
-
*
|
71
|
-
|
72
|
-
*
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
*
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
== 0.3.
|
82
|
-
*
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
== 0.3.
|
87
|
-
*
|
88
|
-
|
89
|
-
*
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
* Added
|
96
|
-
*
|
97
|
-
|
98
|
-
|
99
|
-
== 0.3.
|
100
|
-
* Added
|
101
|
-
*
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
*
|
109
|
-
*
|
110
|
-
|
111
|
-
== 0.
|
112
|
-
*
|
113
|
-
*
|
114
|
-
|
115
|
-
|
116
|
-
|
1
|
+
== 0.5.1 - 20-Oct-2015
|
2
|
+
* The gem is now signed.
|
3
|
+
* The Rakefile gem tasks now assume Rubygems 2.x.
|
4
|
+
* Added a win32-dir.rb file for convenience.
|
5
|
+
|
6
|
+
== 0.5.0 - 15-Oct-2014
|
7
|
+
* Fixed an encoding error in an error message in the Dir.read_junction method.
|
8
|
+
Thanks go to topac for the spot and patch.
|
9
|
+
* Replaced File.exists? with File.exist? in the test suite to avoid warnings
|
10
|
+
in Ruby 2.1 and later.
|
11
|
+
* Do not let the version number fool you, this is not a major release. I
|
12
|
+
simply ran out of version numbers.
|
13
|
+
|
14
|
+
== 0.4.9 - 2-Jul-2014
|
15
|
+
* Fixed the INVALID_FILE_ATTRIBUTES constant. It's only a 32-bit value.
|
16
|
+
Thanks go to Ethan Brown for the patch.
|
17
|
+
* Use relative_require instead of manually doing things.
|
18
|
+
* Removed rubyforge_project from gemspec.
|
19
|
+
* Added a string_check to the Dir.junction? method.
|
20
|
+
|
21
|
+
== 0.4.8 - 27-Apr-2014
|
22
|
+
* More closely mimic Ruby's stringiness checks for overrided methods.
|
23
|
+
|
24
|
+
== 0.4.7 - 26-Apr-2014
|
25
|
+
* All arguments to methods are now interpolated so that they'll use whatever
|
26
|
+
to_str implemenation the argument provides instead of assuming String
|
27
|
+
arguments. This change was made because it turns out that at least some
|
28
|
+
of the overridden methods in MRI accept Pathname objects. Thanks go to
|
29
|
+
Josh Cooper/Puppet Labs for the spot.
|
30
|
+
* Refactored the Dir.getwd method to use bonafide FFI buffers instead of
|
31
|
+
naked Ruby char buffers.
|
32
|
+
* Internally various functions now fail in the event that the resulting
|
33
|
+
paths would exceed their buffers.
|
34
|
+
|
35
|
+
== 0.4.6 - 21-Oct-2013
|
36
|
+
* Fixed the INVALID_HANDLE_VALUE and INVALID_FILE_ATTRIBUTES constants for
|
37
|
+
64-bit versions of Ruby.
|
38
|
+
* Added Rake as a development dependency.
|
39
|
+
|
40
|
+
== 0.4.5 - 23-Sep-2013
|
41
|
+
* Yet another encoding fix, this time one that affected JRuby.
|
42
|
+
* Fixed the Dir[] and Dir.glob methods so they match the spec. Thanks go
|
43
|
+
to Chris Westbrook for the spot.
|
44
|
+
|
45
|
+
== 0.4.4 - 22-Sep-2013
|
46
|
+
* Yet another encoding fix. Thanks go to Rob Reynolds for the patch.
|
47
|
+
|
48
|
+
== 0.4.3 - 24-Jul-2013
|
49
|
+
* Changed the Dir.read_junction and CSIDL constant strings so that they
|
50
|
+
use the default external encoding instead of UTF-16LE. This means that
|
51
|
+
they will now work with methods like File.join. Thanks go to Josh Cooper
|
52
|
+
for the patches.
|
53
|
+
* Some changes for internal handling of making FFI functions private.
|
54
|
+
* Updated gem:create task for rubygems 2.
|
55
|
+
|
56
|
+
== 0.4.2 - 8-Apr-2013
|
57
|
+
* Fixed the HANDLE function prototypes in the underlying FFI code and added
|
58
|
+
some custom typedefs for convenience. This affects 64 bit Ruby code.
|
59
|
+
|
60
|
+
== 0.4.1 - 2-Oct-2012
|
61
|
+
* Added the Dir.read_junction method. Thanks go to Gabriel Wilkins for the patch.
|
62
|
+
|
63
|
+
== 0.4.0 - 29-Jun-2012
|
64
|
+
* Conversion to FFI. Should work with JRuby now.
|
65
|
+
* If current versions of Dir::XXX constant values cannot be found
|
66
|
+
then default values are tried.
|
67
|
+
* Now requires Ruby 1.9 or later.
|
68
|
+
|
69
|
+
== 0.3.7 - 18-Jul-2010
|
70
|
+
* Modified Dir.glob and Dir[] to handle backslashes in path names.
|
71
|
+
* Added tests for the modified Dir.glob and Dir[] behavior.
|
72
|
+
* Removed the old non-gem install Rake task.
|
73
|
+
|
74
|
+
== 0.3.6 - 6-Feb-2010
|
75
|
+
* Bug fixes for Ruby 1.9.x. Thanks go to Kendall Gifford for the spot and
|
76
|
+
the patch.
|
77
|
+
* Minor refactoring of the Dir.create_junction method. This fixed a bug for
|
78
|
+
Ruby 1.9.x, but was also a little cleaner in general.
|
79
|
+
* Some Rakefile task and gemspec updates.
|
80
|
+
|
81
|
+
== 0.3.5 - 6-Aug-2009
|
82
|
+
* Changed the license to Artistic 2.0.
|
83
|
+
* Updated the gemspec, including the addition of a license attribute and
|
84
|
+
test-unit as a development dependency.
|
85
|
+
|
86
|
+
== 0.3.4 - 5-May-2009
|
87
|
+
* Redefined the Dir.getwd (and the Dir.pwd alias) to always return a
|
88
|
+
normalized path.
|
89
|
+
* Some gemspec updates.
|
90
|
+
|
91
|
+
== 0.3.3 - 30-Mar-2009
|
92
|
+
* Virtual folders like Dir::CONTROL, which were previously almost always nil,
|
93
|
+
are now set to their display name.
|
94
|
+
* Fixed a bug in the create_junction method.
|
95
|
+
* Added an 'example' rake task to run the example code.
|
96
|
+
* Renamed the example program from dir_test.rb to dir_example.rb to prevent
|
97
|
+
any potential confusion that it's a genuine test file.
|
98
|
+
|
99
|
+
== 0.3.2 - 25-Jul-2007
|
100
|
+
* Added a Rakefile with tasks for testing and installation.
|
101
|
+
* Removed the install.rb file (the Rakefile handles installation).
|
102
|
+
* Minor updates the README, MANIFEST, and test file.
|
103
|
+
|
104
|
+
== 0.3.1 - 16-Oct-2006
|
105
|
+
* Added the Dir.empty? method.
|
106
|
+
* Changed the Dir.reparse_dir? method to Dir.junction? (but kept an alias
|
107
|
+
for backwards compatibility).
|
108
|
+
* Added rdoc for Dir.junction? (oops).
|
109
|
+
* Some test tweaks and additions.
|
110
|
+
|
111
|
+
== 0.3.0 - 28-May-2006
|
112
|
+
* Now pure Ruby.
|
113
|
+
* Now has a gem.
|
114
|
+
* Added a VERSION constant.
|
115
|
+
|
116
|
+
== 0.2.0 - 27-Jun-2005
|
117
|
+
* Added the Dir.create_junction and Dir.reparse_dir? methods.
|
118
|
+
* Added corresponding tests and documentation.
|
119
|
+
|
120
|
+
== 0.1.0 - 25-Feb-2005
|
121
|
+
* Initial release
|
data/MANIFEST
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
* README
|
2
|
-
* MANIFEST
|
3
|
-
* CHANGES
|
4
|
-
* Rakefile
|
5
|
-
* win32-dir.gemspec
|
6
|
-
* examples/dir_example.rb
|
7
|
-
*
|
8
|
-
*
|
1
|
+
* README
|
2
|
+
* MANIFEST
|
3
|
+
* CHANGES
|
4
|
+
* Rakefile
|
5
|
+
* win32-dir.gemspec
|
6
|
+
* examples/dir_example.rb
|
7
|
+
* certs/djberg96_pub.pem
|
8
|
+
* lib/win32-dir.rb
|
9
|
+
* lib/win32/dir.rb
|
10
|
+
* test/test_win32_dir.rb
|
data/README
CHANGED
@@ -1,273 +1,273 @@
|
|
1
|
-
= Description
|
2
|
-
A series of extra constants for the Dir class that define special folders
|
3
|
-
on MS Windows systems, as well as methods for creating and detecting
|
4
|
-
junctions, i.e. symlinks for directories.
|
5
|
-
|
6
|
-
= Installation
|
7
|
-
gem install win32-dir
|
8
|
-
|
9
|
-
= Synopsis
|
10
|
-
require 'win32/dir'
|
11
|
-
|
12
|
-
# C:\WINNT or C:\WINDOWS
|
13
|
-
puts Dir::WINDOWS
|
14
|
-
|
15
|
-
# C:\Documents and Settings\Daniel\Start Menu\Programs\Administrative Tools
|
16
|
-
puts Dir::ADMINTOOLS
|
17
|
-
|
18
|
-
Dir.mkdir('C:\from')
|
19
|
-
Dir.create_junction('C:\to', 'C:\from')
|
20
|
-
|
21
|
-
= Constants
|
22
|
-
Not all of these are guaranteed to be defined on your system. Also note
|
23
|
-
that the directories are merely defined. It doesn't necessarily mean they
|
24
|
-
actually exist.
|
25
|
-
|
26
|
-
== The following constants should be defined:
|
27
|
-
Dir::ADMINTOOLS
|
28
|
-
The file system directory that is used to store administrative tools for an
|
29
|
-
individual user. The Microsoft Management Console (MMC) will save
|
30
|
-
customized consoles to this directory, and it will roam with the user.
|
31
|
-
|
32
|
-
Dir::COMMON_ADMINTOOLS
|
33
|
-
The file system directory containing administrative tools for all users
|
34
|
-
of the computer.
|
35
|
-
|
36
|
-
Dir::APPDATA
|
37
|
-
The file system directory that serves as a common repository for
|
38
|
-
application-specific data. A typical path is
|
39
|
-
C:\Documents and Settings\<user>\Application Data.
|
40
|
-
|
41
|
-
This CSIDL is supported by the redistributable shfolder.dll for
|
42
|
-
systems that do not have the Microsoft Internet Explorer 4.0
|
43
|
-
integrated Shell installed.
|
44
|
-
|
45
|
-
Dir::COMMON_APPDATA
|
46
|
-
The file system directory containing application data for all users. A
|
47
|
-
typical path is C:\Documents and Settings\All Users\Application Data.
|
48
|
-
|
49
|
-
Dir::COMMON_DOCUMENTS
|
50
|
-
The file system directory that contains documents that are common to all
|
51
|
-
users. A typical paths is C:\Documents and Settings\All Users\Documents.
|
52
|
-
|
53
|
-
Dir::COOKIES
|
54
|
-
The file system directory that serves as a common repository for Internet
|
55
|
-
cookies. A typical path is C:\Documents and Settings\<user>\Cookies.
|
56
|
-
|
57
|
-
Dir::HISTORY
|
58
|
-
The file system directory that serves as a common repository for Internet
|
59
|
-
history items.
|
60
|
-
|
61
|
-
Dir::INTERNET_CACHE
|
62
|
-
The file system directory that serves as a common repository for temporary
|
63
|
-
Internet files. A typical path is
|
64
|
-
C:\Documents and Settings\<user>\Local Settings\Temporary Internet Files.
|
65
|
-
|
66
|
-
Dir::LOCAL_APPDATA
|
67
|
-
The file system directory that serves as a data repository for local
|
68
|
-
(nonroaming) applications. A typical path is
|
69
|
-
C:\Documents and Settings\<user>\Local Settings\Application Data.
|
70
|
-
|
71
|
-
Dir::MYPICTURES
|
72
|
-
The file system directory that serves as a common repository for image
|
73
|
-
files. A typical path is
|
74
|
-
C:\Documents and Settings\<user>\My Documents\My Pictures.
|
75
|
-
|
76
|
-
Dir::PERSONAL
|
77
|
-
The virtual folder representing the My Documents desktop item. This is
|
78
|
-
equivalent to Dir::MYDOCUMENTS.
|
79
|
-
|
80
|
-
Dir::PROGRAM_FILES
|
81
|
-
The Program Files folder. A typical path is C:\Program Files.
|
82
|
-
|
83
|
-
Dir::PROGRAM_FILES_COMMON
|
84
|
-
A folder for components that are shared across applications. A typical path
|
85
|
-
is C:\Program Files\Common.
|
86
|
-
|
87
|
-
Dir::SYSTEM
|
88
|
-
The Windows System folder. A typical path is C:\Windows\System32.
|
89
|
-
|
90
|
-
Dir::WINDOWS
|
91
|
-
The Windows directory or SYSROOT. This corresponds to the %windir% or
|
92
|
-
%SYSTEMROOT% environment variables. A typical path is C:\Windows.
|
93
|
-
|
94
|
-
== The following constants may or may not be defined:
|
95
|
-
Dir::ALTSTARTUP
|
96
|
-
The file system directory that corresponds to the user's nonlocalized
|
97
|
-
Startup program group.
|
98
|
-
|
99
|
-
Dir::BITBUCKET
|
100
|
-
The virtual folder containing the objects in the user's Recycle Bin.
|
101
|
-
|
102
|
-
Dir::CDBURN_AREA
|
103
|
-
The file system directory acting as a staging area for files waiting to
|
104
|
-
be written to CD.
|
105
|
-
|
106
|
-
Dir::COMMON_ALTSTARTUP
|
107
|
-
The file system directory that corresponds to the nonlocalized Startup
|
108
|
-
program group for all users.
|
109
|
-
|
110
|
-
Dir::COMMON_DESKTOPDIRECTORY
|
111
|
-
The file system directory that contains files and folders that appear on
|
112
|
-
the desktop for all users. A typical path is
|
113
|
-
C:\Documents and Settings\All Users\Desktop.
|
114
|
-
|
115
|
-
Dir::COMMON_FAVORITES
|
116
|
-
The file system directory that serves as a common repository for favorite
|
117
|
-
items common to all users.
|
118
|
-
|
119
|
-
Dir::COMMON_MUSIC
|
120
|
-
The file system directory that serves as a repository for music files
|
121
|
-
common to all users.
|
122
|
-
|
123
|
-
Dir::COMMON_PICTURES
|
124
|
-
The file system directory that serves as a repository for image files
|
125
|
-
common to all users.
|
126
|
-
|
127
|
-
Dir::COMMON_PROGRAMS
|
128
|
-
The file system directory that contains the directories for the common
|
129
|
-
program groups that appear on the Start menu for all users.
|
130
|
-
|
131
|
-
Dir::COMMON_STARTMENU
|
132
|
-
The file system directory that contains the programs and folders that
|
133
|
-
appear on the Start menu for all users.
|
134
|
-
|
135
|
-
Dir::COMMON_STARTUP
|
136
|
-
The file system directory that contains the programs that appear in the
|
137
|
-
Startup folder for all users.
|
138
|
-
|
139
|
-
Dir::COMMON_TEMPLATES
|
140
|
-
The file system directory that contains the templates that are available
|
141
|
-
to all users.
|
142
|
-
|
143
|
-
Dir::COMMON_VIDEO
|
144
|
-
The file system directory that serves as a repository for video files
|
145
|
-
common to all users.
|
146
|
-
|
147
|
-
Dir::CONTROLS
|
148
|
-
The virtual folder containing icons for the Control Panel applications.
|
149
|
-
|
150
|
-
Dir::DESKTOP
|
151
|
-
The virtual folder representing the Windows desktop, the root of the
|
152
|
-
namespace.
|
153
|
-
|
154
|
-
Dir::DESKTOPDIRECTORY
|
155
|
-
The file system directory used to physically store file objects on the
|
156
|
-
desktop (not to be confused with the desktop folder itself).
|
157
|
-
|
158
|
-
Dir::DRIVES
|
159
|
-
The virtual folder representing My Computer, containing everything on
|
160
|
-
the local computer: storage devices, printers, and Control Panel. The
|
161
|
-
folder may also contain mapped network drives.
|
162
|
-
|
163
|
-
Dir::FAVORITES
|
164
|
-
The file system directory that serves as a common repository for the
|
165
|
-
user's favorite items.
|
166
|
-
|
167
|
-
Dir::FONTS
|
168
|
-
A virtual folder containing fonts.
|
169
|
-
|
170
|
-
Dir::INTERNET
|
171
|
-
A virtual folder representing the Internet.
|
172
|
-
|
173
|
-
Dir::MYDOCUMENTS
|
174
|
-
The virtual folder representing the My Documents desktop item. See also
|
175
|
-
Dir::PERSONAL.
|
176
|
-
|
177
|
-
Dir::MYMUSIC
|
178
|
-
The file system directory that serves as a common repository for music files.
|
179
|
-
|
180
|
-
Dir::MYVIDEO
|
181
|
-
The file system directory that serves as a common repository for video files.
|
182
|
-
|
183
|
-
Dir::NETHOOD
|
184
|
-
A file system directory containing the link objects that may exist in the
|
185
|
-
My Network Places virtual folder. It is not the same as Dir::NETWORK, which
|
186
|
-
represents the network namespace root.
|
187
|
-
|
188
|
-
Dir::NETWORK
|
189
|
-
A virtual folder representing Network Neighborhood, the root of the network
|
190
|
-
namespace hierarchy.
|
191
|
-
|
192
|
-
Dir::PRINTERS
|
193
|
-
The virtual folder containing installed printers.
|
194
|
-
|
195
|
-
Dir::PRINTHOOD
|
196
|
-
The file system directory that contains the link objects that can exist in
|
197
|
-
the "Printers" virtual folder.
|
198
|
-
|
199
|
-
Dir::PROFILE
|
200
|
-
The user's profile folder.
|
201
|
-
|
202
|
-
Dir::PROFILES
|
203
|
-
The file system directory containing user profile folders.
|
204
|
-
|
205
|
-
Dir::PROGRAMS
|
206
|
-
The file system directory that contains the user's program groups (which
|
207
|
-
are themselves file system directories).
|
208
|
-
|
209
|
-
Dir::RECENT
|
210
|
-
The file system directory that contains shortcuts to the user's most
|
211
|
-
recently used documents.
|
212
|
-
|
213
|
-
Dir::SENDTO
|
214
|
-
The file system directory that contains Send To menu items.
|
215
|
-
|
216
|
-
Dir::STARTMENU
|
217
|
-
The file system directory containing Start menu items.
|
218
|
-
|
219
|
-
Dir::STARTUP
|
220
|
-
The file system directory that corresponds to the user's Startup program
|
221
|
-
group.
|
222
|
-
|
223
|
-
Dir::TEMPLATES
|
224
|
-
The file system directory that serves as a common repository for document
|
225
|
-
templates.
|
226
|
-
|
227
|
-
== Developer's Notes
|
228
|
-
The SHGetFolderPath() documentation on MSDN is somewhat vague about which
|
229
|
-
CSIDL constants are guaranteed to be defined. However, there are 15 which
|
230
|
-
*should* be defined (see docs above). The rest I cannot vouch for.
|
231
|
-
|
232
|
-
Some of these folders are virtual, and the value will be the display name
|
233
|
-
only instead of an actual path.
|
234
|
-
|
235
|
-
== Known Bugs
|
236
|
-
The Dir.create_junction and Dir.read_junction methods do not work with JRuby.
|
237
|
-
|
238
|
-
Please log any bug reports on the project page at
|
239
|
-
http://www.github.com/djberg96/win32-dir
|
240
|
-
|
241
|
-
== Future Plans
|
242
|
-
Suggestions welcome.
|
243
|
-
|
244
|
-
== Acknowledgements
|
245
|
-
Shashank Date and Zach Dennis for the suggestion and supporting comments
|
246
|
-
on the mailing list.
|
247
|
-
|
248
|
-
Timothy Byrd and Autrijus Tang for help (directly or indirectly) with the
|
249
|
-
junction methods. Timothy provided a pure Ruby version of the junction
|
250
|
-
code that I later borrowed from.
|
251
|
-
|
252
|
-
Most of the documentation was copied from the MSDN web site.
|
253
|
-
|
254
|
-
== License
|
255
|
-
Artistic 2.0
|
256
|
-
|
257
|
-
== Contributions
|
258
|
-
Although this library is free, please consider having your company
|
259
|
-
setup a gittip if used by your company professionally.
|
260
|
-
|
261
|
-
http://www.gittip.com/djberg96/
|
262
|
-
|
263
|
-
== Copyright
|
264
|
-
(C) 2003-
|
265
|
-
|
266
|
-
== Warranty
|
267
|
-
This package is provided "as is" and without any express or
|
268
|
-
implied warranties, including, without limitation, the implied
|
269
|
-
warranties of merchantability and fitness for a particular purpose.
|
270
|
-
|
271
|
-
== Authors
|
272
|
-
Daniel J. Berger
|
273
|
-
Park Heesob
|
1
|
+
= Description
|
2
|
+
A series of extra constants for the Dir class that define special folders
|
3
|
+
on MS Windows systems, as well as methods for creating and detecting
|
4
|
+
junctions, i.e. symlinks for directories.
|
5
|
+
|
6
|
+
= Installation
|
7
|
+
gem install win32-dir
|
8
|
+
|
9
|
+
= Synopsis
|
10
|
+
require 'win32/dir'
|
11
|
+
|
12
|
+
# C:\WINNT or C:\WINDOWS
|
13
|
+
puts Dir::WINDOWS
|
14
|
+
|
15
|
+
# C:\Documents and Settings\Daniel\Start Menu\Programs\Administrative Tools
|
16
|
+
puts Dir::ADMINTOOLS
|
17
|
+
|
18
|
+
Dir.mkdir('C:\from')
|
19
|
+
Dir.create_junction('C:\to', 'C:\from')
|
20
|
+
|
21
|
+
= Constants
|
22
|
+
Not all of these are guaranteed to be defined on your system. Also note
|
23
|
+
that the directories are merely defined. It doesn't necessarily mean they
|
24
|
+
actually exist.
|
25
|
+
|
26
|
+
== The following constants should be defined:
|
27
|
+
Dir::ADMINTOOLS
|
28
|
+
The file system directory that is used to store administrative tools for an
|
29
|
+
individual user. The Microsoft Management Console (MMC) will save
|
30
|
+
customized consoles to this directory, and it will roam with the user.
|
31
|
+
|
32
|
+
Dir::COMMON_ADMINTOOLS
|
33
|
+
The file system directory containing administrative tools for all users
|
34
|
+
of the computer.
|
35
|
+
|
36
|
+
Dir::APPDATA
|
37
|
+
The file system directory that serves as a common repository for
|
38
|
+
application-specific data. A typical path is
|
39
|
+
C:\Documents and Settings\<user>\Application Data.
|
40
|
+
|
41
|
+
This CSIDL is supported by the redistributable shfolder.dll for
|
42
|
+
systems that do not have the Microsoft Internet Explorer 4.0
|
43
|
+
integrated Shell installed.
|
44
|
+
|
45
|
+
Dir::COMMON_APPDATA
|
46
|
+
The file system directory containing application data for all users. A
|
47
|
+
typical path is C:\Documents and Settings\All Users\Application Data.
|
48
|
+
|
49
|
+
Dir::COMMON_DOCUMENTS
|
50
|
+
The file system directory that contains documents that are common to all
|
51
|
+
users. A typical paths is C:\Documents and Settings\All Users\Documents.
|
52
|
+
|
53
|
+
Dir::COOKIES
|
54
|
+
The file system directory that serves as a common repository for Internet
|
55
|
+
cookies. A typical path is C:\Documents and Settings\<user>\Cookies.
|
56
|
+
|
57
|
+
Dir::HISTORY
|
58
|
+
The file system directory that serves as a common repository for Internet
|
59
|
+
history items.
|
60
|
+
|
61
|
+
Dir::INTERNET_CACHE
|
62
|
+
The file system directory that serves as a common repository for temporary
|
63
|
+
Internet files. A typical path is
|
64
|
+
C:\Documents and Settings\<user>\Local Settings\Temporary Internet Files.
|
65
|
+
|
66
|
+
Dir::LOCAL_APPDATA
|
67
|
+
The file system directory that serves as a data repository for local
|
68
|
+
(nonroaming) applications. A typical path is
|
69
|
+
C:\Documents and Settings\<user>\Local Settings\Application Data.
|
70
|
+
|
71
|
+
Dir::MYPICTURES
|
72
|
+
The file system directory that serves as a common repository for image
|
73
|
+
files. A typical path is
|
74
|
+
C:\Documents and Settings\<user>\My Documents\My Pictures.
|
75
|
+
|
76
|
+
Dir::PERSONAL
|
77
|
+
The virtual folder representing the My Documents desktop item. This is
|
78
|
+
equivalent to Dir::MYDOCUMENTS.
|
79
|
+
|
80
|
+
Dir::PROGRAM_FILES
|
81
|
+
The Program Files folder. A typical path is C:\Program Files.
|
82
|
+
|
83
|
+
Dir::PROGRAM_FILES_COMMON
|
84
|
+
A folder for components that are shared across applications. A typical path
|
85
|
+
is C:\Program Files\Common.
|
86
|
+
|
87
|
+
Dir::SYSTEM
|
88
|
+
The Windows System folder. A typical path is C:\Windows\System32.
|
89
|
+
|
90
|
+
Dir::WINDOWS
|
91
|
+
The Windows directory or SYSROOT. This corresponds to the %windir% or
|
92
|
+
%SYSTEMROOT% environment variables. A typical path is C:\Windows.
|
93
|
+
|
94
|
+
== The following constants may or may not be defined:
|
95
|
+
Dir::ALTSTARTUP
|
96
|
+
The file system directory that corresponds to the user's nonlocalized
|
97
|
+
Startup program group.
|
98
|
+
|
99
|
+
Dir::BITBUCKET
|
100
|
+
The virtual folder containing the objects in the user's Recycle Bin.
|
101
|
+
|
102
|
+
Dir::CDBURN_AREA
|
103
|
+
The file system directory acting as a staging area for files waiting to
|
104
|
+
be written to CD.
|
105
|
+
|
106
|
+
Dir::COMMON_ALTSTARTUP
|
107
|
+
The file system directory that corresponds to the nonlocalized Startup
|
108
|
+
program group for all users.
|
109
|
+
|
110
|
+
Dir::COMMON_DESKTOPDIRECTORY
|
111
|
+
The file system directory that contains files and folders that appear on
|
112
|
+
the desktop for all users. A typical path is
|
113
|
+
C:\Documents and Settings\All Users\Desktop.
|
114
|
+
|
115
|
+
Dir::COMMON_FAVORITES
|
116
|
+
The file system directory that serves as a common repository for favorite
|
117
|
+
items common to all users.
|
118
|
+
|
119
|
+
Dir::COMMON_MUSIC
|
120
|
+
The file system directory that serves as a repository for music files
|
121
|
+
common to all users.
|
122
|
+
|
123
|
+
Dir::COMMON_PICTURES
|
124
|
+
The file system directory that serves as a repository for image files
|
125
|
+
common to all users.
|
126
|
+
|
127
|
+
Dir::COMMON_PROGRAMS
|
128
|
+
The file system directory that contains the directories for the common
|
129
|
+
program groups that appear on the Start menu for all users.
|
130
|
+
|
131
|
+
Dir::COMMON_STARTMENU
|
132
|
+
The file system directory that contains the programs and folders that
|
133
|
+
appear on the Start menu for all users.
|
134
|
+
|
135
|
+
Dir::COMMON_STARTUP
|
136
|
+
The file system directory that contains the programs that appear in the
|
137
|
+
Startup folder for all users.
|
138
|
+
|
139
|
+
Dir::COMMON_TEMPLATES
|
140
|
+
The file system directory that contains the templates that are available
|
141
|
+
to all users.
|
142
|
+
|
143
|
+
Dir::COMMON_VIDEO
|
144
|
+
The file system directory that serves as a repository for video files
|
145
|
+
common to all users.
|
146
|
+
|
147
|
+
Dir::CONTROLS
|
148
|
+
The virtual folder containing icons for the Control Panel applications.
|
149
|
+
|
150
|
+
Dir::DESKTOP
|
151
|
+
The virtual folder representing the Windows desktop, the root of the
|
152
|
+
namespace.
|
153
|
+
|
154
|
+
Dir::DESKTOPDIRECTORY
|
155
|
+
The file system directory used to physically store file objects on the
|
156
|
+
desktop (not to be confused with the desktop folder itself).
|
157
|
+
|
158
|
+
Dir::DRIVES
|
159
|
+
The virtual folder representing My Computer, containing everything on
|
160
|
+
the local computer: storage devices, printers, and Control Panel. The
|
161
|
+
folder may also contain mapped network drives.
|
162
|
+
|
163
|
+
Dir::FAVORITES
|
164
|
+
The file system directory that serves as a common repository for the
|
165
|
+
user's favorite items.
|
166
|
+
|
167
|
+
Dir::FONTS
|
168
|
+
A virtual folder containing fonts.
|
169
|
+
|
170
|
+
Dir::INTERNET
|
171
|
+
A virtual folder representing the Internet.
|
172
|
+
|
173
|
+
Dir::MYDOCUMENTS
|
174
|
+
The virtual folder representing the My Documents desktop item. See also
|
175
|
+
Dir::PERSONAL.
|
176
|
+
|
177
|
+
Dir::MYMUSIC
|
178
|
+
The file system directory that serves as a common repository for music files.
|
179
|
+
|
180
|
+
Dir::MYVIDEO
|
181
|
+
The file system directory that serves as a common repository for video files.
|
182
|
+
|
183
|
+
Dir::NETHOOD
|
184
|
+
A file system directory containing the link objects that may exist in the
|
185
|
+
My Network Places virtual folder. It is not the same as Dir::NETWORK, which
|
186
|
+
represents the network namespace root.
|
187
|
+
|
188
|
+
Dir::NETWORK
|
189
|
+
A virtual folder representing Network Neighborhood, the root of the network
|
190
|
+
namespace hierarchy.
|
191
|
+
|
192
|
+
Dir::PRINTERS
|
193
|
+
The virtual folder containing installed printers.
|
194
|
+
|
195
|
+
Dir::PRINTHOOD
|
196
|
+
The file system directory that contains the link objects that can exist in
|
197
|
+
the "Printers" virtual folder.
|
198
|
+
|
199
|
+
Dir::PROFILE
|
200
|
+
The user's profile folder.
|
201
|
+
|
202
|
+
Dir::PROFILES
|
203
|
+
The file system directory containing user profile folders.
|
204
|
+
|
205
|
+
Dir::PROGRAMS
|
206
|
+
The file system directory that contains the user's program groups (which
|
207
|
+
are themselves file system directories).
|
208
|
+
|
209
|
+
Dir::RECENT
|
210
|
+
The file system directory that contains shortcuts to the user's most
|
211
|
+
recently used documents.
|
212
|
+
|
213
|
+
Dir::SENDTO
|
214
|
+
The file system directory that contains Send To menu items.
|
215
|
+
|
216
|
+
Dir::STARTMENU
|
217
|
+
The file system directory containing Start menu items.
|
218
|
+
|
219
|
+
Dir::STARTUP
|
220
|
+
The file system directory that corresponds to the user's Startup program
|
221
|
+
group.
|
222
|
+
|
223
|
+
Dir::TEMPLATES
|
224
|
+
The file system directory that serves as a common repository for document
|
225
|
+
templates.
|
226
|
+
|
227
|
+
== Developer's Notes
|
228
|
+
The SHGetFolderPath() documentation on MSDN is somewhat vague about which
|
229
|
+
CSIDL constants are guaranteed to be defined. However, there are 15 which
|
230
|
+
*should* be defined (see docs above). The rest I cannot vouch for.
|
231
|
+
|
232
|
+
Some of these folders are virtual, and the value will be the display name
|
233
|
+
only instead of an actual path.
|
234
|
+
|
235
|
+
== Known Bugs
|
236
|
+
The Dir.create_junction and Dir.read_junction methods do not work with JRuby.
|
237
|
+
|
238
|
+
Please log any bug reports on the project page at
|
239
|
+
http://www.github.com/djberg96/win32-dir
|
240
|
+
|
241
|
+
== Future Plans
|
242
|
+
Suggestions welcome.
|
243
|
+
|
244
|
+
== Acknowledgements
|
245
|
+
Shashank Date and Zach Dennis for the suggestion and supporting comments
|
246
|
+
on the mailing list.
|
247
|
+
|
248
|
+
Timothy Byrd and Autrijus Tang for help (directly or indirectly) with the
|
249
|
+
junction methods. Timothy provided a pure Ruby version of the junction
|
250
|
+
code that I later borrowed from.
|
251
|
+
|
252
|
+
Most of the documentation was copied from the MSDN web site.
|
253
|
+
|
254
|
+
== License
|
255
|
+
Artistic 2.0
|
256
|
+
|
257
|
+
== Contributions
|
258
|
+
Although this library is free, please consider having your company
|
259
|
+
setup a gittip if used by your company professionally.
|
260
|
+
|
261
|
+
http://www.gittip.com/djberg96/
|
262
|
+
|
263
|
+
== Copyright
|
264
|
+
(C) 2003-2015 Daniel J. Berger, All Rights Reserved
|
265
|
+
|
266
|
+
== Warranty
|
267
|
+
This package is provided "as is" and without any express or
|
268
|
+
implied warranties, including, without limitation, the implied
|
269
|
+
warranties of merchantability and fitness for a particular purpose.
|
270
|
+
|
271
|
+
== Authors
|
272
|
+
Daniel J. Berger
|
273
|
+
Park Heesob
|