win32-dir 0.3.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.
data/CHANGES ADDED
@@ -0,0 +1,18 @@
1
+ == 0.3.1 - 16-Oct-2006
2
+ * Added the Dir.empty? method.
3
+ * Changed the Dir.reparse_dir? method to Dir.junction? (but kept an alias
4
+ for backwards compatibility).
5
+ * Added rdoc for Dir.junction? (oops).
6
+ * Some test tweaks and additions.
7
+
8
+ == 0.3.0 - 28-May-2006
9
+ * Now pure Ruby.
10
+ * Now has a gem.
11
+ * Added a VERSION constant.
12
+
13
+ == 0.2.0 - 27-Jun-2005
14
+ * Added the Dir.create_junction and Dir.reparse_dir? methods.
15
+ * Added corresponding tests and documentation.
16
+
17
+ == 0.1.0 - 25-Feb-2005
18
+ * Initial release
@@ -0,0 +1,9 @@
1
+ README
2
+ MANIFEST
3
+ CHANGES
4
+ install.rb
5
+ win32-dir.gemspec
6
+
7
+ examples/dir_test.rb
8
+ lib/win32/dir.rb
9
+ test/tc_dir.rb
data/README ADDED
@@ -0,0 +1,277 @@
1
+ = Description
2
+ A series of extra constants for the Dir class that define special folders
3
+ on Win32 systems, , as well as methods for creating and detecting junctions
4
+ (i.e. symlinks for directories).
5
+
6
+ = Installation
7
+ == Manual
8
+ ruby test\tc_dir.rb (optional)
9
+ ruby install.rb
10
+ == Gems
11
+ ruby win32-dir.gemspec
12
+ gem install win32-dir-X.Y.Z-mswin32.gem
13
+
14
+ = Notes
15
+ Some tests may fail. That is expected, because not all constants are
16
+ necessarily defined on your system.
17
+
18
+ = Synopsis
19
+ require "win32/dir"
20
+
21
+ # C:\WINNT or C:\WINDOWS
22
+ puts Dir::WINDOWS
23
+
24
+ # C:\Documents and Settings\Daniel\Start Menu\Programs\Administrative Tools
25
+ puts Dir::ADMINTOOLS
26
+
27
+ Dir.mkdir('C:\from')
28
+ Dir.create_junction('C:\to', 'C:\from')
29
+
30
+ = Constants
31
+ Not all of these are guaranteed to be defined on your system. Also note
32
+ that the directories are merely defined. It doesn't necessarily mean they
33
+ actually exist.
34
+
35
+ == The following constants should be defined:
36
+ Dir::ADMINTOOLS
37
+ The file system directory that is used to store administrative tools for an
38
+ individual user. The Microsoft Management Console (MMC) will save
39
+ customized consoles to this directory, and it will roam with the user.
40
+
41
+ Dir::COMMON_ADMINTOOLS
42
+ The file system directory containing administrative tools for all users
43
+ of the computer.
44
+
45
+ Dir::APPDATA
46
+ The file system directory that serves as a common repository for
47
+ application-specific data. A typical path is
48
+ C:\Documents and Settings\username\Application Data. This CSIDL is
49
+ supported by the redistributable Shfolder.dll for systems that do not have
50
+ the Microsoft Internet Explorer 4.0 integrated Shell installed.
51
+
52
+ Dir::COMMON_APPDATA
53
+ The file system directory containing application data for all users. A
54
+ typical path is C:\Documents and Settings\All Users\Application Data.
55
+
56
+ Dir::COMMON_DOCUMENTS
57
+ The file system directory that contains documents that are common to all
58
+ users. A typical paths is C:\Documents and Settings\All Users\Documents.
59
+
60
+ Dir::COOKIES
61
+ The file system directory that serves as a common repository for Internet
62
+ cookies. A typical path is C:\Documents and Settings\username\Cookies.
63
+
64
+ Dir::HISTORY
65
+ The file system directory that serves as a common repository for Internet
66
+ history items.
67
+
68
+ Dir::INTERNET_CACHE
69
+ The file system directory that serves as a common repository for temporary
70
+ Internet files. A typical path is
71
+ C:\Documents and Settings\username\Local Settings\Temporary Internet Files.
72
+
73
+ Dir::LOCAL_APPDATA
74
+ The file system directory that serves as a data repository for local
75
+ (nonroaming) applications. A typical path is
76
+ C:\Documents and Settings\username\Local Settings\Application Data.
77
+
78
+ Dir::MYPICTURES
79
+ The file system directory that serves as a common repository for image
80
+ files. A typical path is
81
+ C:\Documents and Settings\username\My Documents\My Pictures.
82
+
83
+ Dir::PERSONAL
84
+ The virtual folder representing the My Documents desktop item. This is
85
+ equivalent to Dir::MYDOCUMENTS.
86
+
87
+ Dir::PROGRAM_FILES
88
+ The Program Files folder. A typical path is C:\Program Files.
89
+
90
+ Dir::PROGRAM_FILES_COMMON
91
+ A folder for components that are shared across applications. A typical path
92
+ is C:\Program Files\Common.
93
+
94
+ Dir::SYSTEM
95
+ The Windows System folder. A typical path is C:\Windows\System32.
96
+
97
+ Dir::WINDOWS
98
+ The Windows directory or SYSROOT. This corresponds to the %windir% or
99
+ %SYSTEMROOT% environment variables. A typical path is C:\Windows.
100
+
101
+ == The following constants may or may not be defined:
102
+ Dir::ALTSTARTUP
103
+ The file system directory that corresponds to the user's nonlocalized
104
+ Startup program group.
105
+
106
+ Dir::BITBUCKET
107
+ The virtual folder containing the objects in the user's Recycle Bin.
108
+
109
+ Dir::CDBURN_AREA
110
+ The file system directory acting as a staging area for files waiting to
111
+ be written to CD.
112
+
113
+ Dir::COMMON_ALTSTARTUP
114
+ The file system directory that corresponds to the nonlocalized Startup
115
+ program group for all users.
116
+
117
+ Dir::COMMON_DESKTOPDIRECTORY
118
+ The file system directory that contains files and folders that appear on
119
+ the desktop for all users. A typical path is
120
+ C:\Documents and Settings\All Users\Desktop.
121
+
122
+ Dir::COMMON_FAVORITES
123
+ The file system directory that serves as a common repository for favorite
124
+ items common to all users.
125
+
126
+ Dir::COMMON_MUSIC
127
+ The file system directory that serves as a repository for music files
128
+ common to all users.
129
+
130
+ Dir::COMMON_PICTURES
131
+ The file system directory that serves as a repository for image files
132
+ common to all users.
133
+
134
+ Dir::COMMON_PROGRAMS
135
+ The file system directory that contains the directories for the common
136
+ program groups that appear on the Start menu for all users.
137
+
138
+ Dir::COMMON_STARTMENU
139
+ The file system directory that contains the programs and folders that
140
+ appear on the Start menu for all users.
141
+
142
+ Dir::COMMON_STARTUP
143
+ The file system directory that contains the programs that appear in the
144
+ Startup folder for all users.
145
+
146
+ Dir::COMMON_TEMPLATES
147
+ The file system directory that contains the templates that are available
148
+ to all users.
149
+
150
+ Dir::COMMON_VIDEO
151
+ The file system directory that serves as a repository for video files
152
+ common to all users.
153
+
154
+ Dir::CONTROLS
155
+ The virtual folder containing icons for the Control Panel applications.
156
+
157
+ Dir::DESKTOP
158
+ The virtual folder representing the Windows desktop, the root of the
159
+ namespace.
160
+
161
+ Dir::DESKTOPDIRECTORY
162
+ The file system directory used to physically store file objects on the
163
+ desktop (not to be confused with the desktop folder itself).
164
+
165
+ Dir::DRIVES
166
+ The virtual folder representing My Computer, containing everything on
167
+ the local computer: storage devices, printers, and Control Panel. The
168
+ folder may also contain mapped network drives.
169
+
170
+ Dir::FAVORITES
171
+ The file system directory that serves as a common repository for the
172
+ user's favorite items.
173
+
174
+ Dir::FONTS
175
+ A virtual folder containing fonts.
176
+
177
+ Dir::INTERNET
178
+ A virtual folder representing the Internet.
179
+
180
+ Dir::MYDOCUMENTS
181
+ The virtual folder representing the My Documents desktop item. See also
182
+ Dir::PERSONAL.
183
+
184
+ Dir::MYMUSIC
185
+ The file system directory that serves as a common repository for music
186
+ files.
187
+
188
+ Dir::MYVIDEO
189
+ The file system directory that serves as a common repository for video
190
+ files.
191
+
192
+ Dir::NETHOOD
193
+ A file system directory containing the link objects that may exist in the
194
+ My Network Places virtual folder. It is not the same as Dir::NETWORK, which
195
+ represents the network namespace root.
196
+
197
+ Dir::NETWORK
198
+ A virtual folder representing Network Neighborhood, the root of the network
199
+ namespace hierarchy.
200
+
201
+ Dir::PRINTERS
202
+ The virtual folder containing installed printers.
203
+
204
+ Dir::PRINTHOOD
205
+ The file system directory that contains the link objects that can exist in
206
+ the "Printers" virtual folder.
207
+
208
+ Dir::PROFILE
209
+ The user's profile folder.
210
+
211
+ Dir::PROFILES
212
+ The file system directory containing user profile folders.
213
+
214
+ Dir::PROGRAMS
215
+ The file system directory that contains the user's program groups (which
216
+ are themselves file system directories).
217
+
218
+ Dir::RECENT
219
+ The file system directory that contains shortcuts to the user's most
220
+ recently used documents.
221
+
222
+ Dir::SENDTO
223
+ The file system directory that contains Send To menu items.
224
+
225
+ Dir::STARTMENU
226
+ The file system directory containing Start menu items.
227
+
228
+ Dir::STARTUP
229
+ The file system directory that corresponds to the user's Startup program
230
+ group.
231
+
232
+ Dir::TEMPLATES
233
+ The file system directory that serves as a common repository for document
234
+ templates.
235
+
236
+ == Developer's Notes
237
+ The SHGetFolderPath() documentation on MSDN is somewhat vague about which
238
+ CSIDL constants are guaranteed to be defined. However, there are 15 which
239
+ *should* be defined (see docs above). The rest I cannot vouch for. On
240
+ my own Windows XP SP 2 system, all but 7 were defined.
241
+
242
+ == Known Bugs
243
+ The Unicode support is not quite there for Dir.create_junction. It creates
244
+ the directory and junction fine, but the +to+ name appears to get garbled
245
+ with regards to the character set.
246
+
247
+ Please log any other bug reports on the RubyForge project page at
248
+ http://www.rubyforge.net/projects/win32utils.
249
+
250
+ == Future Plans
251
+ Fix the Unicode issue with Dir.create_junction.
252
+ Other suggestions welcome.
253
+
254
+ == Acknowledgements
255
+ Shashank Date and Zach Dennis for the suggestion and supporting comments
256
+ on the mailing list.
257
+
258
+ Timothy Byrd and Autrijus Tang for help (directly or indirectly) with the
259
+ junction methods. Timothy provided a pure Ruby version of the junction
260
+ code that I later borrowed from.
261
+
262
+ Most of the documentation was copied from the MSDN web site.
263
+
264
+ == License
265
+ Ruby's
266
+
267
+ == Copyright
268
+ (C) 2003-2006 Daniel J. Berger, All Rights Reserved
269
+
270
+ == Warranty
271
+ This package is provided "as is" and without any express or
272
+ implied warranties, including, without limitation, the implied
273
+ warranties of merchantability and fitness for a particular purpose.
274
+
275
+ == Authors
276
+ Daniel J. Berger
277
+ Park Heesob
@@ -0,0 +1,11 @@
1
+ # For those who don't like gems...
2
+ require 'rbconfig'
3
+ require 'ftools'
4
+ include Config
5
+
6
+ sitelibdir = CONFIG['sitelibdir']
7
+ installdir = sitelibdir + '/win32'
8
+ file = 'lib\win32\dir.rb'
9
+
10
+ Dir.mkdir(installdir) unless File.exists?(installdir)
11
+ File.copy(file, installdir, true)
@@ -0,0 +1,153 @@
1
+ require 'windows/directory'
2
+ require 'windows/shell'
3
+ require 'windows/file'
4
+ require 'windows/error'
5
+ require 'windows/device_io'
6
+ require 'windows/unicode'
7
+ require 'windows/directory'
8
+ require 'windows/handle'
9
+ require 'windows/path'
10
+
11
+ class Dir
12
+ include Windows::Directory
13
+ include Windows::Shell
14
+ include Windows::Error
15
+ include Windows::File
16
+ include Windows::DeviceIO
17
+ extend Windows::Directory
18
+ extend Windows::Shell
19
+ extend Windows::File
20
+ extend Windows::Error
21
+ extend Windows::DeviceIO
22
+ extend Windows::Unicode
23
+ extend Windows::Handle
24
+ extend Windows::Path
25
+
26
+ VERSION = '0.3.1'
27
+
28
+ # Dynamically set each of the CSIDL_ constants
29
+ constants.grep(/CSIDL/).each{ |constant|
30
+ path = 0.chr * 260
31
+ nconst = constant.split('CSIDL_').last
32
+
33
+ if SHGetFolderPath(0, const_get(constant), 0, 1, path) != 0
34
+ path = nil
35
+ else
36
+ path.strip!
37
+ end
38
+
39
+ Dir.const_set(nconst, path)
40
+ }
41
+
42
+ # Creates the symlink +to+, linked to the existing directory +from+. If the
43
+ # +to+ directory already exists, it must be empty or an error is raised.
44
+ #
45
+ def self.create_junction(to, from)
46
+ # Normalize the paths
47
+ to.tr!('/', "\\")
48
+ from.tr!('/', "\\")
49
+
50
+ to_path = 0.chr * 260
51
+ from_path = 0.chr * 260
52
+ buf_target = 0.chr * 260
53
+
54
+ if GetFullPathName(from, from_path.size, from_path, 0) == 0
55
+ raise StandardError, 'GetFullPathName() failed: ' + get_last_error
56
+ end
57
+
58
+ if GetFullPathName(to, to_path.size, to_path, 0) == 0
59
+ raise StandardError, 'GetFullPathName() failed: ' + get_last_error
60
+ end
61
+
62
+ to_path = to_path.split(0.chr).first
63
+ from_path = from_path.split(0.chr).first
64
+
65
+ # You can create a junction to a directory that already exists, so
66
+ # long as it's empty.
67
+ rv = CreateDirectory(to_path, 0)
68
+ if rv == 0 && rv != ERROR_ALREADY_EXISTS
69
+ raise StandardError, 'CreateDirectory() failed: ' + get_last_error
70
+ end
71
+
72
+ handle = CreateFile(
73
+ to_path,
74
+ GENERIC_READ | GENERIC_WRITE,
75
+ 0,
76
+ 0,
77
+ OPEN_EXISTING,
78
+ FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS,
79
+ 0
80
+ )
81
+
82
+ if handle == INVALID_HANDLE_VALUE
83
+ raise StandardError, 'CreateFile() failed: ' + get_last_error
84
+ end
85
+
86
+ buf_target = buf_target.split(0.chr).first
87
+ buf_target = "\\??\\" << from_path
88
+ length = buf_target.size * 2 # sizeof(WCHAR)
89
+ wide_string = multi_to_wide(buf_target)
90
+
91
+ # REPARSE_JDATA_BUFFER
92
+ rdb = [
93
+ "0xA0000003L".hex, # ReparseTag (IO_REPARSE_TAG_MOUNT_POINT)
94
+ wide_string.size + 12, # ReparseDataLength
95
+ 0, # Reserved
96
+ 0, # SubstituteNameOffset
97
+ wide_string.size, # SubstituteNameLength
98
+ wide_string.size + 2, # PrintNameOffset
99
+ 0, # PrintNameLength
100
+ wide_string # PathBuffer
101
+ ].pack('LSSSSSSa' + (wide_string.size + 4).to_s)
102
+
103
+ bytes = [0].pack('L')
104
+
105
+ bool = DeviceIoControl(
106
+ handle,
107
+ CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_ANY_ACCESS),
108
+ rdb,
109
+ rdb.size,
110
+ 0,
111
+ 0,
112
+ bytes,
113
+ 0
114
+ )
115
+
116
+ unless bool
117
+ error = 'DeviceIoControl() failed: ' + get_last_error
118
+ RemoveDirectory(to)
119
+ CloseHandle(handle)
120
+ raise error
121
+ end
122
+
123
+ CloseHandle(handle)
124
+
125
+ self
126
+ end
127
+
128
+ # Returns whether or not +path+ is empty. Returns false if +path+ is not
129
+ # a directory, or contains any files other than '.' or '..'.
130
+ #
131
+ def self.empty?(path)
132
+ PathIsDirectoryEmpty(path)
133
+ end
134
+
135
+ # Returns whether or not +path+ is a junction.
136
+ #
137
+ def self.junction?(path)
138
+ bool = true
139
+ attrib = GetFileAttributes(path)
140
+
141
+ bool = false if attrib == INVALID_FILE_ATTRIBUTES
142
+ bool = false if attrib & FILE_ATTRIBUTE_DIRECTORY == 0
143
+ bool = false if attrib & FILE_ATTRIBUTE_REPARSE_POINT == 0
144
+
145
+ bool
146
+ end
147
+
148
+ # Class level aliases
149
+ #
150
+ class << self
151
+ alias reparse_dir? junction?
152
+ end
153
+ end
@@ -0,0 +1,320 @@
1
+ ###########################################################################
2
+ # tc_dir.rb
3
+ #
4
+ # Test suite for the win32-dir package. Note that some of these tests
5
+ # may fail, because some constants are simply not defined, depending on
6
+ # your operating system and version of certain DLL files.
7
+ ###########################################################################
8
+ base = File.basename(Dir.pwd)
9
+
10
+ if base == 'test' || base =~ /win32-dir/
11
+ Dir.chdir('..') if base == 'test'
12
+ $LOAD_PATH.unshift(Dir.pwd + '/lib')
13
+ Dir.chdir('test') rescue nil
14
+ end
15
+
16
+ require 'test/unit'
17
+ require 'win32/dir'
18
+ require 'fileutils'
19
+
20
+ puts "Some tests may fail because some constants aren't defined on your system."
21
+ puts "This is not unexpected."
22
+
23
+ class TC_Win32_Dir < Test::Unit::TestCase
24
+ def setup
25
+ @from = "from"
26
+ @ascii_to = "to"
27
+ @unicode_to = "Ελλάσ" # Greek - the word is 'Hellas'
28
+ Dir.mkdir(@from)
29
+ end
30
+
31
+ def test_version
32
+ assert_equal('0.3.1', Dir::VERSION)
33
+ end
34
+
35
+ def test_create_junction
36
+ assert_respond_to(Dir, :create_junction)
37
+ assert_nothing_raised{ Dir.create_junction(@ascii_to, @from) }
38
+ assert_nothing_raised{ Dir.create_junction(@unicode_to, @from) }
39
+
40
+ # If we've gotten this far, make sure files created in the @from
41
+ # directory show up in the linked directories.
42
+ File.open(@from + "\\test.txt", "w+"){ |f| f.puts "Hello World" }
43
+
44
+ assert_equal(Dir.entries(@from), Dir.entries(@ascii_to))
45
+ assert_equal(Dir.entries(@from), Dir.entries(@unicode_to))
46
+ end
47
+
48
+ def test_is_junction
49
+ assert_respond_to(Dir, :junction?)
50
+ assert_respond_to(Dir, :reparse_dir?) # alias
51
+ assert_nothing_raised{ Dir.junction?(@from) }
52
+ assert_nothing_raised{ Dir.create_junction(@ascii_to, @from) }
53
+
54
+ assert_equal(false, Dir.junction?(@from))
55
+ assert_equal(true, Dir.junction?(@ascii_to))
56
+ end
57
+
58
+ def test_is_empty
59
+ assert_respond_to(Dir, :empty?)
60
+ assert_equal(false, Dir.empty?("C:\\")) # One would hope
61
+ assert_equal(true, Dir.empty?(@from))
62
+ end
63
+
64
+ def test_admintools
65
+ assert_not_nil(Dir::ADMINTOOLS, "+IGNORE+")
66
+ assert_kind_of(String, Dir::ADMINTOOLS)
67
+ end
68
+
69
+ def test_altstartup
70
+ assert_not_nil(Dir::ALTSTARTUP, "+IGNORE+")
71
+ assert_kind_of(String, Dir::ALTSTARTUP)
72
+ end
73
+
74
+ def test_appdata
75
+ assert_not_nil(Dir::APPDATA, "+IGNORE+")
76
+ assert_kind_of(String, Dir::APPDATA)
77
+ end
78
+
79
+ def test_bitbucket
80
+ assert_not_nil(Dir::BITBUCKET, "+IGNORE+")
81
+ assert_kind_of(String, Dir::BITBUCKET)
82
+ end
83
+
84
+ def test_cdburn_area
85
+ assert_not_nil(Dir::CDBURN_AREA, "+IGNORE+")
86
+ assert_kind_of(String, Dir::CDBURN_AREA)
87
+ end
88
+
89
+ def test_common_admintools
90
+ assert_not_nil(Dir::COMMON_ADMINTOOLS, "+IGNORE+")
91
+ assert_kind_of(String, Dir::COMMON_ADMINTOOLS)
92
+ end
93
+
94
+ def test_common_altstartup
95
+ assert_not_nil(Dir::COMMON_ALTSTARTUP, "+IGNORE+")
96
+ assert_kind_of(String, Dir::COMMON_ALTSTARTUP)
97
+ end
98
+
99
+ def test_common_appdata
100
+ assert_not_nil(Dir::COMMON_APPDATA, "+IGNORE+")
101
+ assert_kind_of(String, Dir::COMMON_APPDATA)
102
+ end
103
+
104
+ def test_common_desktopdirectory
105
+ assert_not_nil(Dir::COMMON_DESKTOPDIRECTORY, "+IGNORE+")
106
+ assert_kind_of(String, Dir::COMMON_DESKTOPDIRECTORY)
107
+ end
108
+
109
+ def test_common_documents
110
+ assert_not_nil(Dir::COMMON_DOCUMENTS, "+IGNORE+")
111
+ assert_kind_of(String, Dir::COMMON_DOCUMENTS)
112
+ end
113
+
114
+ def test_common_favorites
115
+ assert_not_nil(Dir::COMMON_FAVORITES, "+IGNORE+")
116
+ assert_kind_of(String, Dir::COMMON_FAVORITES)
117
+ end
118
+
119
+ def test_common_music
120
+ assert_not_nil(Dir::COMMON_MUSIC, "+IGNORE+")
121
+ assert_kind_of(String, Dir::COMMON_MUSIC)
122
+ end
123
+
124
+ def test_common_pictures
125
+ assert_not_nil(Dir::COMMON_PICTURES, "+IGNORE+")
126
+ assert_kind_of(String, Dir::COMMON_PICTURES)
127
+ end
128
+
129
+ def test_common_programs
130
+ assert_not_nil(Dir::COMMON_PROGRAMS, "+IGNORE+")
131
+ assert_kind_of(String, Dir::COMMON_PROGRAMS)
132
+ end
133
+
134
+ def test_common_startmenu
135
+ assert_not_nil(Dir::COMMON_STARTMENU, "+IGNORE+")
136
+ assert_kind_of(String, Dir::COMMON_STARTMENU)
137
+ end
138
+
139
+ def test_common_startup
140
+ assert_not_nil(Dir::COMMON_STARTUP, "+IGNORE+")
141
+ assert_kind_of(String, Dir::COMMON_STARTUP)
142
+ end
143
+
144
+ def test_common_templates
145
+ assert_not_nil(Dir::COMMON_TEMPLATES, "+IGNORE+")
146
+ assert_kind_of(String, Dir::COMMON_TEMPLATES)
147
+ end
148
+
149
+ def test_common_video
150
+ assert_not_nil(Dir::COMMON_VIDEO, "+IGNORE+")
151
+ assert_kind_of(String, Dir::COMMON_VIDEO)
152
+ end
153
+
154
+ def test_controls
155
+ assert_not_nil(Dir::CONTROLS, "+IGNORE+")
156
+ assert_kind_of(String, Dir::CONTROLS)
157
+ end
158
+
159
+ def test_cookies
160
+ assert_not_nil(Dir::COOKIES, "+IGNORE+")
161
+ assert_kind_of(String, Dir::COOKIES)
162
+ end
163
+
164
+ def test_desktop
165
+ assert_not_nil(Dir::DESKTOP, "+IGNORE+")
166
+ assert_kind_of(String, Dir::DESKTOP)
167
+ end
168
+
169
+ def test_desktopdirectory
170
+ assert_not_nil(Dir::DESKTOPDIRECTORY, "+IGNORE+")
171
+ assert_kind_of(String, Dir::DESKTOPDIRECTORY)
172
+ end
173
+
174
+ def test_drives
175
+ assert_not_nil(Dir::DRIVES, "+IGNORE+")
176
+ assert_kind_of(String, Dir::DRIVES)
177
+ end
178
+
179
+ def test_favorites
180
+ assert_not_nil(Dir::FAVORITES, "+IGNORE+")
181
+ assert_kind_of(String, Dir::FAVORITES)
182
+ end
183
+
184
+ def test_fonts
185
+ assert_not_nil(Dir::FONTS, "+IGNORE+")
186
+ assert_kind_of(String, Dir::FONTS)
187
+ end
188
+
189
+ def test_history
190
+ assert_not_nil(Dir::HISTORY, "+IGNORE+")
191
+ assert_kind_of(String, Dir::HISTORY)
192
+ end
193
+
194
+ def test_internet
195
+ assert_not_nil(Dir::INTERNET, "+IGNORE+")
196
+ assert_kind_of(String, Dir::INTERNET)
197
+ end
198
+
199
+ def test_internet_cache
200
+ assert_not_nil(Dir::INTERNET_CACHE, "+IGNORE+")
201
+ assert_kind_of(String, Dir::INTERNET_CACHE)
202
+ end
203
+
204
+ def test_local_appdata
205
+ assert_not_nil(Dir::LOCAL_APPDATA, "+IGNORE+")
206
+ assert_kind_of(String, Dir::LOCAL_APPDATA)
207
+ end
208
+
209
+ def test_mydocuments
210
+ assert_not_nil(Dir::MYDOCUMENTS, "+IGNORE+")
211
+ assert_kind_of(String, Dir::MYDOCUMENTS)
212
+ end
213
+
214
+ def test_local_mymusic
215
+ assert_not_nil(Dir::MYMUSIC, "+IGNORE+")
216
+ assert_kind_of(String, Dir::MYMUSIC)
217
+ end
218
+
219
+ def test_local_mypictures
220
+ assert_not_nil(Dir::MYPICTURES, "+IGNORE+")
221
+ assert_kind_of(String, Dir::MYPICTURES)
222
+ end
223
+
224
+ def test_local_myvideo
225
+ assert_not_nil(Dir::MYVIDEO, "+IGNORE+")
226
+ assert_kind_of(String, Dir::MYVIDEO)
227
+ end
228
+
229
+ def test_nethood
230
+ assert_not_nil(Dir::NETHOOD, "+IGNORE+")
231
+ assert_kind_of(String, Dir::NETHOOD)
232
+ end
233
+
234
+ def test_network
235
+ assert_not_nil(Dir::NETWORK, "+IGNORE+")
236
+ assert_kind_of(String, Dir::NETWORK)
237
+ end
238
+
239
+ def test_personal
240
+ assert_not_nil(Dir::PERSONAL, "+IGNORE+")
241
+ assert_kind_of(String, Dir::PERSONAL)
242
+ end
243
+
244
+ def test_printers
245
+ assert_not_nil(Dir::PRINTERS, "+IGNORE+")
246
+ assert_kind_of(String, Dir::PRINTERS)
247
+ end
248
+
249
+ def test_printhood
250
+ assert_not_nil(Dir::PRINTHOOD, "+IGNORE+")
251
+ assert_kind_of(String, Dir::PRINTHOOD)
252
+ end
253
+
254
+ def test_profile
255
+ assert_not_nil(Dir::PROFILE, "+IGNORE+")
256
+ assert_kind_of(String, Dir::PROFILE)
257
+ end
258
+
259
+ # Doesn't appear to actually exist
260
+ #def test_profiles
261
+ # assert_not_nil(Dir::PROFILES)
262
+ # assert_kind_of(String,Dir::PROFILES)
263
+ #end
264
+
265
+ def test_program_files
266
+ assert_not_nil(Dir::PROGRAM_FILES, "+IGNORE+")
267
+ assert_kind_of(String, Dir::PROGRAM_FILES)
268
+ end
269
+
270
+ def test_program_files_common
271
+ assert_not_nil(Dir::PROGRAM_FILES_COMMON, "+IGNORE+")
272
+ assert_kind_of(String, Dir::PROGRAM_FILES_COMMON)
273
+ end
274
+
275
+ def test_programs
276
+ assert_not_nil(Dir::PROGRAMS, "+IGNORE+")
277
+ assert_kind_of(String, Dir::PROGRAMS)
278
+ end
279
+
280
+ def test_recent
281
+ assert_not_nil(Dir::RECENT, "+IGNORE+")
282
+ assert_kind_of(String, Dir::RECENT)
283
+ end
284
+
285
+ def test_sendto
286
+ assert_not_nil(Dir::SENDTO, "+IGNORE+")
287
+ assert_kind_of(String, Dir::SENDTO)
288
+ end
289
+
290
+ def test_startmenu
291
+ assert_not_nil(Dir::STARTMENU, "+IGNORE+")
292
+ assert_kind_of(String, Dir::STARTMENU)
293
+ end
294
+
295
+ def test_startup
296
+ assert_not_nil(Dir::STARTUP, "+IGNORE+")
297
+ assert_kind_of(String, Dir::STARTUP)
298
+ end
299
+
300
+ def test_system
301
+ assert_not_nil(Dir::SYSTEM, "+IGNORE+")
302
+ assert_kind_of(String, Dir::SYSTEM)
303
+ end
304
+
305
+ def test_templates
306
+ assert_not_nil(Dir::TEMPLATES, "+IGNORE+")
307
+ assert_kind_of(String, Dir::TEMPLATES)
308
+ end
309
+
310
+ def test_windows_dir
311
+ assert_not_nil(Dir::WINDOWS, "+IGNORE+")
312
+ assert_kind_of(String, Dir::WINDOWS)
313
+ end
314
+
315
+ def teardown
316
+ Dir.rmdir(@ascii_to) rescue nil
317
+ Dir.rmdir(@unicode_to) rescue nil
318
+ FileUtils.rm_rf(@from) rescue nil
319
+ end
320
+ end
File without changes
@@ -0,0 +1,24 @@
1
+ require "rubygems"
2
+
3
+ spec = Gem::Specification.new do |gem|
4
+ gem.name = "win32-dir"
5
+ gem.version = "0.3.1"
6
+ gem.author = "Daniel J. Berger"
7
+ gem.email = "djberg96@gmail.com"
8
+ gem.homepage = "http://www.rubyforge.org/projects/win32utils"
9
+ gem.platform = Gem::Platform::RUBY
10
+ gem.summary = "Extra constants and methods for the Dir class on Windows."
11
+ gem.description = "Extra constants and methods for the Dir class on Windows."
12
+ gem.test_file = "test/tc_dir.rb"
13
+ gem.has_rdoc = true
14
+ gem.files = Dir["lib/win32/*.rb"] + Dir["test/*"] + Dir["[A-Z]*"]
15
+ gem.files.reject! { |fn| fn.include? "CVS" }
16
+ gem.require_path = "lib"
17
+ gem.extra_rdoc_files = ["README", "CHANGES"]
18
+ gem.add_dependency("windows-pr", ">= 0.5.1")
19
+ end
20
+
21
+ if $0 == __FILE__
22
+ Gem.manage_gems
23
+ Gem::Builder.new(spec).build
24
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.0
3
+ specification_version: 1
4
+ name: win32-dir
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.3.1
7
+ date: 2006-10-16 00:00:00 -06:00
8
+ summary: Extra constants and methods for the Dir class on Windows.
9
+ require_paths:
10
+ - lib
11
+ email: djberg96@gmail.com
12
+ homepage: http://www.rubyforge.org/projects/win32utils
13
+ rubyforge_project:
14
+ description: Extra constants and methods for the Dir class on Windows.
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Daniel J. Berger
31
+ files:
32
+ - lib/win32/dir.rb
33
+ - test/tc_dir.rb
34
+ - CHANGES
35
+ - examples
36
+ - install.rb
37
+ - lib
38
+ - MANIFEST
39
+ - README
40
+ - test
41
+ - win32-dir-0.3.1.gem
42
+ - win32-dir.gemspec
43
+ test_files:
44
+ - test/tc_dir.rb
45
+ rdoc_options: []
46
+
47
+ extra_rdoc_files:
48
+ - README
49
+ - CHANGES
50
+ executables: []
51
+
52
+ extensions: []
53
+
54
+ requirements: []
55
+
56
+ dependencies:
57
+ - !ruby/object:Gem::Dependency
58
+ name: windows-pr
59
+ version_requirement:
60
+ version_requirements: !ruby/object:Gem::Version::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 0.5.1
65
+ version: