win32-dir 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
data/lib/win32/dir.rb CHANGED
@@ -11,208 +11,213 @@ require 'windows/limits'
11
11
  require 'windows/system_info'
12
12
 
13
13
  class Dir
14
- include Windows::Directory
15
- include Windows::Shell
16
- include Windows::Error
17
- include Windows::File
18
- include Windows::DeviceIO
19
- include Windows::Limits
14
+ include Windows::Directory
15
+ include Windows::Shell
16
+ include Windows::Error
17
+ include Windows::File
18
+ include Windows::DeviceIO
19
+ include Windows::Limits
20
20
 
21
- extend Windows::Directory
22
- extend Windows::Shell
23
- extend Windows::File
24
- extend Windows::Error
25
- extend Windows::DeviceIO
26
- extend Windows::Unicode
27
- extend Windows::Handle
28
- extend Windows::Path
29
- extend Windows::Limits
30
- extend Windows::SystemInfo
21
+ extend Windows::Directory
22
+ extend Windows::Shell
23
+ extend Windows::File
24
+ extend Windows::Error
25
+ extend Windows::DeviceIO
26
+ extend Windows::Unicode
27
+ extend Windows::Handle
28
+ extend Windows::Path
29
+ extend Windows::Limits
30
+ extend Windows::SystemInfo
31
31
 
32
- # The version of the win32-dir library.
33
- VERSION = '0.3.5'
32
+ # The version of the win32-dir library.
33
+ VERSION = '0.3.6'
34
34
 
35
- # Dynamically set each of the CSIDL_ constants
36
- constants.grep(/CSIDL/).each{ |constant|
37
- path = 0.chr * MAXPATH
38
- nconst = constant.split('CSIDL_').last
35
+ # Dynamically set each of the CSIDL_ constants
36
+ constants.grep(/CSIDL/).each{ |constant|
37
+ path = 0.chr * MAXPATH
38
+ nconst = constant.to_s.split('CSIDL_').last # to_s call for 1.9.x
39
39
 
40
- if SHGetFolderPath(0, const_get(constant), 0, 1, path) != 0
41
- path = nil
42
- else
43
- path.strip!
44
- end
40
+ if SHGetFolderPath(0, const_get(constant), 0, 1, path) != 0
41
+ path = nil
42
+ else
43
+ path.strip!
44
+ end
45
45
 
46
- # Try another approach for virtual folders
47
- if path.nil?
48
- ppidl = 0.chr * 4 # PIDLIST_ABSOLUTE
46
+ # Try another approach for virtual folders
47
+ if path.nil?
48
+ ppidl = 0.chr * 4 # PIDLIST_ABSOLUTE
49
49
 
50
- if SHGetFolderLocation(0, const_get(constant), 0, 0, ppidl) == S_OK
51
- info = 0.chr * 692 # sizeof(SHFILEINFO)
52
- flags = SHGFI_DISPLAYNAME | SHGFI_PIDL
53
- SHGetFileInfo(ppidl.unpack('L')[0], 0, info, 692, flags)
54
- path = info[12..-1].strip
55
- end
50
+ if SHGetFolderLocation(0, const_get(constant), 0, 0, ppidl) == S_OK
51
+ info = 0.chr * 692 # sizeof(SHFILEINFO)
52
+ flags = SHGFI_DISPLAYNAME | SHGFI_PIDL
53
+ SHGetFileInfo(ppidl.unpack('L')[0], 0, info, 692, flags)
54
+ path = info[12..-1].strip
56
55
  end
56
+ end
57
57
 
58
- Dir.const_set(nconst, path) if path
59
- }
58
+ Dir.const_set(nconst, path) if path
59
+ }
60
60
 
61
- # Set Dir::MYDOCUMENTS to the same as Dir::PERSONAL if undefined
62
- unless defined? MYDOCUMENTS
63
- # Same as Dir::PERSONAL
64
- MYDOCUMENTS = PERSONAL
65
- end
61
+ # Set Dir::MYDOCUMENTS to the same as Dir::PERSONAL if undefined
62
+ unless defined? MYDOCUMENTS
63
+ # Same as Dir::PERSONAL
64
+ MYDOCUMENTS = PERSONAL
65
+ end
66
66
 
67
- class << self
68
- remove_method :getwd
69
- end
67
+ class << self
68
+ remove_method :getwd
69
+ remove_method :pwd
70
+ end
70
71
 
71
- # Returns the present working directory. Unlike MRI, this method always
72
- # normalizes the path.
73
- #
74
- # Examples:
75
- #
76
- # Dir.chdir("C:/Progra~1")
77
- # Dir.getwd # => C:\Program Files
78
- #
79
- # Dir.chdir("C:/PROGRAM FILES")
80
- # Dir.getwd # => C:\Program Files
81
- #
82
- def self.getwd
83
- path1 = 0.chr * MAXPATH
84
- path2 = 0.chr * MAXPATH
85
- path3 = 0.chr * MAXPATH
72
+ # Returns the present working directory. Unlike MRI, this method always
73
+ # normalizes the path.
74
+ #
75
+ # Examples:
76
+ #
77
+ # Dir.chdir("C:/Progra~1")
78
+ # Dir.getwd # => C:\Program Files
79
+ #
80
+ # Dir.chdir("C:/PROGRAM FILES")
81
+ # Dir.getwd # => C:\Program Files
82
+ #
83
+ def self.getwd
84
+ path1 = 0.chr * MAXPATH
85
+ path2 = 0.chr * MAXPATH
86
+ path3 = 0.chr * MAXPATH
86
87
 
87
- GetCurrentDirectory(MAXPATH, path1)
88
- GetShortPathName(path1, path2, MAXPATH)
89
- GetLongPathName(path2, path3, MAXPATH)
88
+ GetCurrentDirectory(MAXPATH, path1)
89
+ GetShortPathName(path1, path2, MAXPATH)
90
+ GetLongPathName(path2, path3, MAXPATH)
90
91
 
91
- path3[/^[^\0]*/]
92
- end
92
+ path3[/^[^\0]*/]
93
+ end
93
94
 
94
- class << self
95
- alias :pwd :getwd
96
- end
95
+ class << self
96
+ alias :pwd :getwd
97
+ end
97
98
 
98
- # Creates the symlink +to+, linked to the existing directory +from+. If the
99
- # +to+ directory already exists, it must be empty or an error is raised.
100
- #
101
- # Example:
102
- #
103
- # Dir.mkdir('C:\from')
104
- # Dir.create_junction('C:\to', 'C:\from')
105
- #
106
- def self.create_junction(to, from)
107
- to = to.tr(File::SEPARATOR, File::ALT_SEPARATOR) # Normalize path
108
- from = from.tr(File::SEPARATOR, File::ALT_SEPARATOR) # Normalize path
109
-
110
- to_path = 0.chr * MAXPATH
111
- from_path = 0.chr * MAXPATH
112
- buf_target = 0.chr * MAXPATH
99
+ # Creates the symlink +to+, linked to the existing directory +from+. If the
100
+ # +to+ directory already exists, it must be empty or an error is raised.
101
+ #
102
+ # Example:
103
+ #
104
+ # Dir.mkdir('C:/from')
105
+ # Dir.create_junction('C:/to', 'C:/from')
106
+ #
107
+ def self.create_junction(to, from)
108
+ to = to.tr(File::SEPARATOR, File::ALT_SEPARATOR) # Normalize path
109
+ from = from.tr(File::SEPARATOR, File::ALT_SEPARATOR) # Normalize path
113
110
 
114
- if GetFullPathName(from, from_path.size, from_path, 0) == 0
115
- raise StandardError, 'GetFullPathName() failed: ' + get_last_error
116
- end
111
+ to_path = 0.chr * MAXPATH
112
+ from_path = 0.chr * MAXPATH
113
+ buf_target = 0.chr * MAXPATH
117
114
 
118
- if GetFullPathName(to, to_path.size, to_path, 0) == 0
119
- raise StandardError, 'GetFullPathName() failed: ' + get_last_error
120
- end
121
-
122
- to_path = to_path.split(0.chr).first
123
- from_path = from_path.split(0.chr).first
115
+ length = GetFullPathName(from, from_path.size, from_path, 0)
116
+
117
+ if length == 0
118
+ raise StandardError, 'GetFullPathName() failed: ' + get_last_error
119
+ else
120
+ from_path = from_path[0..length-1]
121
+ end
124
122
 
125
- # You can create a junction to a directory that already exists, so
126
- # long as it's empty.
127
- rv = CreateDirectory(to_path, 0)
123
+ length = GetFullPathName(to, to_path.size, to_path, 0)
128
124
 
129
- if rv == 0 && rv != ERROR_ALREADY_EXISTS
130
- raise StandardError, 'CreateDirectory() failed: ' + get_last_error
131
- end
125
+ if length == 0
126
+ raise StandardError, 'GetFullPathName() failed: ' + get_last_error
127
+ else
128
+ to_path = to_path[0..length-1]
129
+ end
130
+
131
+ # You can create a junction to a directory that already exists, so
132
+ # long as it's empty.
133
+ rv = CreateDirectory(to_path, 0)
134
+
135
+ if rv == 0 && rv != ERROR_ALREADY_EXISTS
136
+ raise StandardError, 'CreateDirectory() failed: ' + get_last_error
137
+ end
132
138
 
133
- handle = CreateFile(
134
- to_path,
135
- GENERIC_READ | GENERIC_WRITE,
136
- 0,
137
- 0,
138
- OPEN_EXISTING,
139
- FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS,
140
- 0
141
- )
139
+ handle = CreateFile(
140
+ to_path,
141
+ GENERIC_READ | GENERIC_WRITE,
142
+ 0,
143
+ 0,
144
+ OPEN_EXISTING,
145
+ FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS,
146
+ 0
147
+ )
142
148
 
143
- if handle == INVALID_HANDLE_VALUE
144
- raise StandardError, 'CreateFile() failed: ' + get_last_error
145
- end
149
+ if handle == INVALID_HANDLE_VALUE
150
+ raise StandardError, 'CreateFile() failed: ' + get_last_error
151
+ end
146
152
 
147
- buf_target = buf_target.split(0.chr).first
148
- buf_target = "\\??\\" << from_path
149
- wide_string = multi_to_wide(buf_target)[0..-3]
153
+ buf_target = buf_target.split(0.chr).first
154
+ buf_target = "\\??\\" << from_path
155
+ wide_string = multi_to_wide(buf_target)[0..-3]
150
156
 
151
- # REPARSE_JDATA_BUFFER
152
- rdb = [
153
- "0xA0000003L".hex, # ReparseTag (IO_REPARSE_TAG_MOUNT_POINT)
154
- wide_string.size + 12, # ReparseDataLength
155
- 0, # Reserved
156
- 0, # SubstituteNameOffset
157
- wide_string.size, # SubstituteNameLength
158
- wide_string.size + 2, # PrintNameOffset
159
- 0, # PrintNameLength
160
- wide_string # PathBuffer
161
- ].pack('LSSSSSSa' + (wide_string.size + 4).to_s)
157
+ # REPARSE_JDATA_BUFFER
158
+ rdb = [
159
+ "0xA0000003L".hex, # ReparseTag (IO_REPARSE_TAG_MOUNT_POINT)
160
+ wide_string.size + 12, # ReparseDataLength
161
+ 0, # Reserved
162
+ 0, # SubstituteNameOffset
163
+ wide_string.size, # SubstituteNameLength
164
+ wide_string.size + 2, # PrintNameOffset
165
+ 0, # PrintNameLength
166
+ wide_string # PathBuffer
167
+ ].pack('LSSSSSSa' + (wide_string.size + 4).to_s)
162
168
 
163
- bytes = [0].pack('L')
169
+ bytes = [0].pack('L')
164
170
 
165
- begin
166
- bool = DeviceIoControl(
167
- handle,
168
- CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, 0),
169
- rdb,
170
- rdb.size,
171
- 0,
172
- 0,
173
- bytes,
174
- 0
175
- )
171
+ begin
172
+ bool = DeviceIoControl(
173
+ handle,
174
+ CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, 0),
175
+ rdb,
176
+ rdb.size,
177
+ 0,
178
+ 0,
179
+ bytes,
180
+ 0
181
+ )
176
182
 
177
- unless bool
178
- error = 'DeviceIoControl() failed: ' + get_last_error
179
- RemoveDirectory(to_path)
180
- raise error
181
- end
182
- ensure
183
- CloseHandle(handle)
183
+ unless bool
184
+ error = 'DeviceIoControl() failed: ' + get_last_error
185
+ RemoveDirectory(to_path)
186
+ raise error
184
187
  end
188
+ ensure
189
+ CloseHandle(handle)
190
+ end
185
191
 
186
- self
187
- end
192
+ self
193
+ end
188
194
 
189
- # Returns whether or not +path+ is empty. Returns false if +path+ is not
190
- # a directory, or contains any files other than '.' or '..'.
191
- #
192
- def self.empty?(path)
193
- PathIsDirectoryEmpty(path)
194
- end
195
+ # Returns whether or not +path+ is empty. Returns false if +path+ is not
196
+ # a directory, or contains any files other than '.' or '..'.
197
+ #
198
+ def self.empty?(path)
199
+ PathIsDirectoryEmpty(path)
200
+ end
195
201
 
196
- # Returns whether or not +path+ is a junction.
197
- #
198
- def self.junction?(path)
199
- bool = true
200
- attrib = GetFileAttributes(path)
202
+ # Returns whether or not +path+ is a junction.
203
+ #
204
+ def self.junction?(path)
205
+ bool = true
206
+ attrib = GetFileAttributes(path)
201
207
 
202
-
203
- if attrib == INVALID_FILE_ATTRIBUTES ||
204
- attrib & FILE_ATTRIBUTE_DIRECTORY == 0 ||
205
- attrib & FILE_ATTRIBUTE_REPARSE_POINT == 0
206
- then
207
- bool = false
208
- end
208
+ if attrib == INVALID_FILE_ATTRIBUTES ||
209
+ attrib & FILE_ATTRIBUTE_DIRECTORY == 0 ||
210
+ attrib & FILE_ATTRIBUTE_REPARSE_POINT == 0
211
+ then
212
+ bool = false
213
+ end
209
214
 
210
- bool
211
- end
215
+ bool
216
+ end
212
217
 
213
- # Class level aliases
214
- #
215
- class << self
216
- alias reparse_dir? junction?
217
- end
218
+ # Class level aliases
219
+ #
220
+ class << self
221
+ alias reparse_dir? junction?
222
+ end
218
223
  end
@@ -0,0 +1,356 @@
1
+ # encoding: utf-8
2
+ ###########################################################################
3
+ # test_win32_dir.rb
4
+ #
5
+ # Test suite for the win32-dir library. You should run this test case
6
+ # via the 'rake test' task.
7
+ ###########################################################################
8
+ require 'rubygems'
9
+ gem 'test-unit'
10
+
11
+ require 'test/unit'
12
+ require 'win32/dir'
13
+ require 'fileutils'
14
+
15
+ class TC_Win32_Dir < Test::Unit::TestCase
16
+ def self.startup
17
+ @@test_home = File.dirname(File.expand_path(__FILE__))
18
+ end
19
+
20
+ def setup
21
+ Dir.chdir(@@test_home) unless File.basename(Dir.pwd) == 'test'
22
+ @@from = File.join(Dir.pwd, "test_from_directory")
23
+
24
+ @ascii_to = "test_to_directory"
25
+ @unicode_to = "Ελλάσ" # Greek - the word is 'Hellas'
26
+ @test_file = File.join(@@from, "test.txt")
27
+ Dir.mkdir(@@from)
28
+ end
29
+
30
+ def test_version
31
+ assert_equal('0.3.6', Dir::VERSION)
32
+ end
33
+
34
+ def test_create_junction_basic
35
+ assert_respond_to(Dir, :create_junction)
36
+ end
37
+
38
+ def test_create_junction_ascii
39
+ assert_nothing_raised{ Dir.create_junction(@ascii_to, @@from) }
40
+ assert_true(File.exists?(@ascii_to))
41
+ File.open(@test_file, 'w'){ |fh| fh.puts "Hello World" }
42
+ assert_equal(Dir.entries(@@from), Dir.entries(@ascii_to))
43
+ end
44
+
45
+ def test_create_junction_unicode
46
+ assert_nothing_raised{ Dir.create_junction(@unicode_to, @@from) }
47
+ assert_true(File.exists?(@unicode_to))
48
+ File.open(@test_file, 'w'){ |fh| fh.puts "Hello World" }
49
+ assert_equal(Dir.entries(@@from), Dir.entries(@unicode_to))
50
+ end
51
+
52
+ def test_is_junction
53
+ assert_respond_to(Dir, :junction?)
54
+ assert_nothing_raised{ Dir.create_junction(@ascii_to, @@from) }
55
+ assert_equal(false, Dir.junction?(@@from))
56
+ assert_equal(true, Dir.junction?(@ascii_to))
57
+ end
58
+
59
+ def test_reparse_dir_alias
60
+ assert_respond_to(Dir, :reparse_dir?) # alias
61
+ assert_equal(true, Dir.method(:reparse_dir?) == Dir.method(:junction?))
62
+ end
63
+
64
+ def test_is_empty
65
+ assert_respond_to(Dir, :empty?)
66
+ assert_equal(false, Dir.empty?("C:\\")) # One would think
67
+ assert_equal(true, Dir.empty?(@@from))
68
+ end
69
+
70
+ def test_pwd_basic
71
+ assert_respond_to(Dir, :pwd)
72
+ assert_nothing_raised{ Dir.pwd }
73
+ assert_kind_of(String, Dir.pwd)
74
+ end
75
+
76
+ def test_pwd_short_path
77
+ Dir.chdir("C:\\Progra~1")
78
+ assert_equal("C:\\Program Files", Dir.pwd)
79
+ end
80
+
81
+ def test_pwd_long_path
82
+ Dir.chdir("C:\\Program Files")
83
+ assert_equal("C:\\Program Files", Dir.pwd)
84
+ end
85
+
86
+ def test_pwd_caps
87
+ Dir.chdir("C:\\PROGRAM FILES")
88
+ assert_equal("C:\\Program Files", Dir.pwd)
89
+ end
90
+
91
+ def test_pwd_forward_slash
92
+ Dir.chdir("C:/Program Files")
93
+ assert_equal("C:\\Program Files", Dir.pwd)
94
+ end
95
+
96
+ def test_pwd_is_proper_alias
97
+ assert_true(Dir.method(:getwd) == Dir.method(:pwd))
98
+ end
99
+
100
+ def test_admintools
101
+ assert_not_nil(Dir::ADMINTOOLS)
102
+ assert_kind_of(String, Dir::ADMINTOOLS)
103
+ end
104
+
105
+ def test_altstartup
106
+ assert_not_nil(Dir::ALTSTARTUP)
107
+ assert_kind_of(String, Dir::ALTSTARTUP)
108
+ end
109
+
110
+ def test_appdata
111
+ assert_not_nil(Dir::APPDATA)
112
+ assert_kind_of(String, Dir::APPDATA)
113
+ end
114
+
115
+ def test_bitbucket
116
+ assert_not_nil(Dir::BITBUCKET)
117
+ assert_kind_of(String, Dir::BITBUCKET)
118
+ end
119
+
120
+ def test_cdburn_area
121
+ assert_not_nil(Dir::CDBURN_AREA)
122
+ assert_kind_of(String, Dir::CDBURN_AREA)
123
+ end
124
+
125
+ def test_common_admintools
126
+ assert_not_nil(Dir::COMMON_ADMINTOOLS)
127
+ assert_kind_of(String, Dir::COMMON_ADMINTOOLS)
128
+ end
129
+
130
+ def test_common_altstartup
131
+ assert_not_nil(Dir::COMMON_ALTSTARTUP)
132
+ assert_kind_of(String, Dir::COMMON_ALTSTARTUP)
133
+ end
134
+
135
+ def test_common_appdata
136
+ assert_not_nil(Dir::COMMON_APPDATA)
137
+ assert_kind_of(String, Dir::COMMON_APPDATA)
138
+ end
139
+
140
+ def test_common_desktopdirectory
141
+ assert_not_nil(Dir::COMMON_DESKTOPDIRECTORY)
142
+ assert_kind_of(String, Dir::COMMON_DESKTOPDIRECTORY)
143
+ end
144
+
145
+ def test_common_documents
146
+ assert_not_nil(Dir::COMMON_DOCUMENTS)
147
+ assert_kind_of(String, Dir::COMMON_DOCUMENTS)
148
+ end
149
+
150
+ def test_common_favorites
151
+ assert_not_nil(Dir::COMMON_FAVORITES)
152
+ assert_kind_of(String, Dir::COMMON_FAVORITES)
153
+ end
154
+
155
+ def test_common_music
156
+ assert_not_nil(Dir::COMMON_MUSIC)
157
+ assert_kind_of(String, Dir::COMMON_MUSIC)
158
+ end
159
+
160
+ def test_common_pictures
161
+ assert_not_nil(Dir::COMMON_PICTURES)
162
+ assert_kind_of(String, Dir::COMMON_PICTURES)
163
+ end
164
+
165
+ def test_common_programs
166
+ assert_not_nil(Dir::COMMON_PROGRAMS)
167
+ assert_kind_of(String, Dir::COMMON_PROGRAMS)
168
+ end
169
+
170
+ def test_common_startmenu
171
+ assert_not_nil(Dir::COMMON_STARTMENU)
172
+ assert_kind_of(String, Dir::COMMON_STARTMENU)
173
+ end
174
+
175
+ def test_common_startup
176
+ assert_not_nil(Dir::COMMON_STARTUP)
177
+ assert_kind_of(String, Dir::COMMON_STARTUP)
178
+ end
179
+
180
+ def test_common_templates
181
+ assert_not_nil(Dir::COMMON_TEMPLATES)
182
+ assert_kind_of(String, Dir::COMMON_TEMPLATES)
183
+ end
184
+
185
+ def test_common_video
186
+ assert_not_nil(Dir::COMMON_VIDEO)
187
+ assert_kind_of(String, Dir::COMMON_VIDEO)
188
+ end
189
+
190
+ def test_controls
191
+ assert_not_nil(Dir::CONTROLS)
192
+ assert_kind_of(String, Dir::CONTROLS)
193
+ end
194
+
195
+ def test_cookies
196
+ assert_not_nil(Dir::COOKIES)
197
+ assert_kind_of(String, Dir::COOKIES)
198
+ end
199
+
200
+ def test_desktop
201
+ assert_not_nil(Dir::DESKTOP)
202
+ assert_kind_of(String, Dir::DESKTOP)
203
+ end
204
+
205
+ def test_desktopdirectory
206
+ assert_not_nil(Dir::DESKTOPDIRECTORY)
207
+ assert_kind_of(String, Dir::DESKTOPDIRECTORY)
208
+ end
209
+
210
+ def test_drives
211
+ assert_not_nil(Dir::DRIVES)
212
+ assert_kind_of(String, Dir::DRIVES)
213
+ end
214
+
215
+ def test_favorites
216
+ assert_not_nil(Dir::FAVORITES)
217
+ assert_kind_of(String, Dir::FAVORITES)
218
+ end
219
+
220
+ def test_fonts
221
+ assert_not_nil(Dir::FONTS)
222
+ assert_kind_of(String, Dir::FONTS)
223
+ end
224
+
225
+ def test_history
226
+ assert_not_nil(Dir::HISTORY)
227
+ assert_kind_of(String, Dir::HISTORY)
228
+ end
229
+
230
+ def test_internet
231
+ assert_not_nil(Dir::INTERNET)
232
+ assert_kind_of(String, Dir::INTERNET)
233
+ end
234
+
235
+ def test_internet_cache
236
+ assert_not_nil(Dir::INTERNET_CACHE)
237
+ assert_kind_of(String, Dir::INTERNET_CACHE)
238
+ end
239
+
240
+ def test_local_appdata
241
+ assert_not_nil(Dir::LOCAL_APPDATA)
242
+ assert_kind_of(String, Dir::LOCAL_APPDATA)
243
+ end
244
+
245
+ def test_mydocuments
246
+ assert_not_nil(Dir::MYDOCUMENTS)
247
+ assert_kind_of(String, Dir::MYDOCUMENTS)
248
+ end
249
+
250
+ def test_local_mymusic
251
+ assert_not_nil(Dir::MYMUSIC)
252
+ assert_kind_of(String, Dir::MYMUSIC)
253
+ end
254
+
255
+ def test_local_mypictures
256
+ assert_not_nil(Dir::MYPICTURES)
257
+ assert_kind_of(String, Dir::MYPICTURES)
258
+ end
259
+
260
+ def test_local_myvideo
261
+ assert_not_nil(Dir::MYVIDEO)
262
+ assert_kind_of(String, Dir::MYVIDEO)
263
+ end
264
+
265
+ def test_nethood
266
+ assert_not_nil(Dir::NETHOOD)
267
+ assert_kind_of(String, Dir::NETHOOD)
268
+ end
269
+
270
+ def test_network
271
+ assert_not_nil(Dir::NETWORK)
272
+ assert_kind_of(String, Dir::NETWORK)
273
+ end
274
+
275
+ def test_personal
276
+ assert_not_nil(Dir::PERSONAL)
277
+ assert_kind_of(String, Dir::PERSONAL)
278
+ end
279
+
280
+ def test_printers
281
+ assert_not_nil(Dir::PRINTERS)
282
+ assert_kind_of(String, Dir::PRINTERS)
283
+ end
284
+
285
+ def test_printhood
286
+ assert_not_nil(Dir::PRINTHOOD)
287
+ assert_kind_of(String, Dir::PRINTHOOD)
288
+ end
289
+
290
+ def test_profile
291
+ assert_not_nil(Dir::PROFILE)
292
+ assert_kind_of(String, Dir::PROFILE)
293
+ end
294
+
295
+ # Doesn't appear to actually exist
296
+ #def test_profiles
297
+ # assert_not_nil(Dir::PROFILES)
298
+ # assert_kind_of(String,Dir::PROFILES)
299
+ #end
300
+
301
+ def test_program_files
302
+ assert_not_nil(Dir::PROGRAM_FILES)
303
+ assert_kind_of(String, Dir::PROGRAM_FILES)
304
+ end
305
+
306
+ def test_program_files_common
307
+ assert_not_nil(Dir::PROGRAM_FILES_COMMON)
308
+ assert_kind_of(String, Dir::PROGRAM_FILES_COMMON)
309
+ end
310
+
311
+ def test_programs
312
+ assert_not_nil(Dir::PROGRAMS)
313
+ assert_kind_of(String, Dir::PROGRAMS)
314
+ end
315
+
316
+ def test_recent
317
+ assert_not_nil(Dir::RECENT)
318
+ assert_kind_of(String, Dir::RECENT)
319
+ end
320
+
321
+ def test_sendto
322
+ assert_not_nil(Dir::SENDTO)
323
+ assert_kind_of(String, Dir::SENDTO)
324
+ end
325
+
326
+ def test_startmenu
327
+ assert_not_nil(Dir::STARTMENU)
328
+ assert_kind_of(String, Dir::STARTMENU)
329
+ end
330
+
331
+ def test_startup
332
+ assert_not_nil(Dir::STARTUP)
333
+ assert_kind_of(String, Dir::STARTUP)
334
+ end
335
+
336
+ def test_system
337
+ assert_not_nil(Dir::SYSTEM)
338
+ assert_kind_of(String, Dir::SYSTEM)
339
+ end
340
+
341
+ def test_templates
342
+ assert_not_nil(Dir::TEMPLATES)
343
+ assert_kind_of(String, Dir::TEMPLATES)
344
+ end
345
+
346
+ def test_windows_dir
347
+ assert_not_nil(Dir::WINDOWS)
348
+ assert_kind_of(String, Dir::WINDOWS)
349
+ end
350
+
351
+ def teardown
352
+ FileUtils.rm_rf(@ascii_to)
353
+ FileUtils.rm_rf(@unicode_to)
354
+ FileUtils.rm_rf(@@from)
355
+ end
356
+ end