win32-dir 0.3.7 → 0.4.0
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 +6 -0
- data/MANIFEST +8 -8
- data/README +4 -9
- data/Rakefile +6 -1
- data/examples/dir_example.rb +22 -22
- data/lib/win32/dir.rb +264 -176
- data/lib/win32/dir/constants.rb +18 -0
- data/lib/win32/dir/functions.rb +35 -0
- data/lib/win32/dir/structs.rb +29 -0
- data/test/test_win32_dir.rb +143 -137
- data/win32-dir.gemspec +4 -4
- metadata +62 -64
@@ -0,0 +1,18 @@
|
|
1
|
+
module Dir::Constants
|
2
|
+
private
|
3
|
+
|
4
|
+
FILE_DEVICE_FILE_SYSTEM = 0x00000009
|
5
|
+
INVALID_HANDLE_VALUE = 0xFFFFFFFF
|
6
|
+
INVALID_FILE_ATTRIBUTES = 0xFFFFFFFF
|
7
|
+
FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000
|
8
|
+
FILE_FLAG_BACKUP_SEMANTICS = 0x02000000
|
9
|
+
FILE_ATTRIBUTE_DIRECTORY = 0x00000010
|
10
|
+
FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400
|
11
|
+
ERROR_ALREADY_EXISTS = 183
|
12
|
+
METHOD_BUFFERED = 0
|
13
|
+
OPEN_EXISTING = 3
|
14
|
+
GENERIC_READ = 0x80000000
|
15
|
+
GENERIC_WRITE = 0x40000000
|
16
|
+
SHGFI_DISPLAYNAME = 0x000000200
|
17
|
+
SHGFI_PIDL = 0x000000008
|
18
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Necessary to force JRuby to use the gem, not its builtin version
|
2
|
+
if RUBY_PLATFORM == 'java'
|
3
|
+
require 'rubygems'
|
4
|
+
gem 'ffi'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'ffi'
|
8
|
+
|
9
|
+
module Dir::Functions
|
10
|
+
extend FFI::Library
|
11
|
+
|
12
|
+
ffi_lib :shell32
|
13
|
+
|
14
|
+
attach_function :SHGetFolderPathW, [:ulong, :int, :ulong, :ulong, :buffer_out], :ulong
|
15
|
+
attach_function :SHGetFolderLocation, [:ulong, :int, :ulong, :ulong, :pointer], :ulong
|
16
|
+
attach_function :SHGetFileInfo, [:ulong, :ulong, :pointer, :uint, :uint], :ulong
|
17
|
+
|
18
|
+
ffi_lib :shlwapi
|
19
|
+
|
20
|
+
attach_function :PathIsDirectoryEmptyW, [:buffer_in], :bool
|
21
|
+
|
22
|
+
ffi_lib :kernel32
|
23
|
+
|
24
|
+
attach_function :CloseHandle, [:ulong], :bool
|
25
|
+
attach_function :CreateDirectoryW, [:buffer_in, :pointer], :bool
|
26
|
+
attach_function :CreateFileW, [:buffer_in, :ulong, :ulong, :pointer, :ulong, :ulong, :ulong], :ulong
|
27
|
+
attach_function :DeviceIoControl, [:ulong, :ulong, :pointer, :ulong, :pointer, :ulong, :pointer, :pointer], :bool
|
28
|
+
attach_function :GetCurrentDirectoryW, [:ulong, :buffer_out], :ulong
|
29
|
+
attach_function :GetFileAttributesW, [:buffer_in], :ulong
|
30
|
+
attach_function :GetLastError, [], :ulong
|
31
|
+
attach_function :GetShortPathNameW, [:buffer_in, :buffer_out, :ulong], :ulong
|
32
|
+
attach_function :GetLongPathNameW, [:buffer_in, :buffer_out, :ulong], :ulong
|
33
|
+
attach_function :GetFullPathNameW, [:buffer_in, :ulong, :buffer_out, :pointer], :ulong
|
34
|
+
attach_function :RemoveDirectoryW, [:buffer_in], :bool
|
35
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'ffi'
|
2
|
+
|
3
|
+
module Dir::Structs
|
4
|
+
extend FFI::Library
|
5
|
+
|
6
|
+
class SHFILEINFO < FFI::Struct
|
7
|
+
layout(
|
8
|
+
:hIcon, :ulong,
|
9
|
+
:iIcon, :int,
|
10
|
+
:dwAttributes, :ulong,
|
11
|
+
:szDisplayName, [:char, 256],
|
12
|
+
:szTypeName, [:char, 80]
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
# I fudge a bit, assuming a MountPointReparseBuffer
|
17
|
+
class REPARSE_JDATA_BUFFER < FFI::Struct
|
18
|
+
layout(
|
19
|
+
:ReparseTag, :ulong,
|
20
|
+
:ReparseDataLength, :ushort,
|
21
|
+
:Reserved, :ushort,
|
22
|
+
:SubstituteNameOffset, :ushort,
|
23
|
+
:SubstituteNameLength, :ushort,
|
24
|
+
:PrintNameOffset, :ushort,
|
25
|
+
:PrintNameLength, :ushort,
|
26
|
+
:PathBuffer, [:char, 1024]
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
data/test/test_win32_dir.rb
CHANGED
@@ -5,30 +5,27 @@
|
|
5
5
|
# Test suite for the win32-dir library. You should run this test case
|
6
6
|
# via the 'rake test' task.
|
7
7
|
###########################################################################
|
8
|
-
require '
|
9
|
-
gem 'test-unit'
|
10
|
-
|
11
|
-
require 'test/unit'
|
8
|
+
require 'test-unit'
|
12
9
|
require 'win32/dir'
|
10
|
+
require 'tmpdir'
|
13
11
|
require 'fileutils'
|
14
12
|
|
15
13
|
class TC_Win32_Dir < Test::Unit::TestCase
|
16
14
|
def self.startup
|
17
|
-
@@
|
15
|
+
@@java = RUBY_PLATFORM == 'java'
|
16
|
+
@@temp = Dir.tmpdir
|
17
|
+
@@from = File.join(@@temp, "test_from_directory")
|
18
|
+
Dir.mkdir(@@from)
|
18
19
|
end
|
19
20
|
|
20
21
|
def setup
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
@ascii_to = "test_to_directory"
|
25
|
-
@unicode_to = "Ελλάσ" # Greek - the word is 'Hellas'
|
22
|
+
@ascii_to = File.join(@@temp, "test_to_directory")
|
23
|
+
@unicode_to = File.join(@@temp, "Ελλάσ")
|
26
24
|
@test_file = File.join(@@from, "test.txt")
|
27
|
-
Dir.mkdir(@@from)
|
28
25
|
end
|
29
|
-
|
26
|
+
|
30
27
|
def test_version
|
31
|
-
assert_equal('0.
|
28
|
+
assert_equal('0.4.0', Dir::VERSION)
|
32
29
|
end
|
33
30
|
|
34
31
|
test 'glob handles backslashes' do
|
@@ -53,327 +50,336 @@ class TC_Win32_Dir < Test::Unit::TestCase
|
|
53
50
|
assert_nothing_raised{ Dir[pattern] }
|
54
51
|
assert_true(Dir[pattern].size > 0)
|
55
52
|
end
|
56
|
-
|
57
|
-
|
53
|
+
|
54
|
+
test "create_junction basic functionality" do
|
58
55
|
assert_respond_to(Dir, :create_junction)
|
59
56
|
end
|
60
57
|
|
61
|
-
|
58
|
+
test "create_junction works as expected with ascii characters" do
|
62
59
|
assert_nothing_raised{ Dir.create_junction(@ascii_to, @@from) }
|
63
60
|
assert_true(File.exists?(@ascii_to))
|
64
61
|
File.open(@test_file, 'w'){ |fh| fh.puts "Hello World" }
|
65
62
|
assert_equal(Dir.entries(@@from), Dir.entries(@ascii_to))
|
66
63
|
end
|
67
64
|
|
68
|
-
|
65
|
+
test "create_junction works as expected with unicode characters" do
|
69
66
|
assert_nothing_raised{ Dir.create_junction(@unicode_to, @@from) }
|
70
67
|
assert_true(File.exists?(@unicode_to))
|
71
68
|
File.open(@test_file, 'w'){ |fh| fh.puts "Hello World" }
|
72
69
|
assert_equal(Dir.entries(@@from), Dir.entries(@unicode_to))
|
73
70
|
end
|
74
|
-
|
75
|
-
|
71
|
+
|
72
|
+
test "junction? method returns boolean value" do
|
76
73
|
assert_respond_to(Dir, :junction?)
|
77
74
|
assert_nothing_raised{ Dir.create_junction(@ascii_to, @@from) }
|
78
|
-
|
79
|
-
|
75
|
+
assert_false(Dir.junction?(@@from))
|
76
|
+
assert_true(Dir.junction?(@ascii_to))
|
80
77
|
end
|
81
78
|
|
82
|
-
|
83
|
-
assert_respond_to(Dir, :reparse_dir?)
|
84
|
-
|
79
|
+
test "reparse_dir? is an aliase for junction?" do
|
80
|
+
assert_respond_to(Dir, :reparse_dir?)
|
81
|
+
assert_true(Dir.method(:reparse_dir?) == Dir.method(:junction?))
|
85
82
|
end
|
86
|
-
|
87
|
-
|
83
|
+
|
84
|
+
test "empty? method returns expected result" do
|
88
85
|
assert_respond_to(Dir, :empty?)
|
89
|
-
|
90
|
-
|
86
|
+
assert_false(Dir.empty?("C:\\")) # One would think
|
87
|
+
assert_true(Dir.empty?(@@from))
|
91
88
|
end
|
92
89
|
|
93
|
-
|
90
|
+
test "pwd basic functionality" do
|
91
|
+
omit_if(@@java)
|
94
92
|
assert_respond_to(Dir, :pwd)
|
95
93
|
assert_nothing_raised{ Dir.pwd }
|
96
94
|
assert_kind_of(String, Dir.pwd)
|
97
95
|
end
|
98
96
|
|
99
|
-
|
97
|
+
test "pwd returns full path even if short path was just used" do
|
98
|
+
omit_if(@@java)
|
100
99
|
Dir.chdir("C:\\Progra~1")
|
101
100
|
assert_equal("C:\\Program Files", Dir.pwd)
|
102
101
|
end
|
103
102
|
|
104
|
-
|
103
|
+
test "pwd returns full path if long path was just used" do
|
104
|
+
omit_if(@@java)
|
105
105
|
Dir.chdir("C:\\Program Files")
|
106
106
|
assert_equal("C:\\Program Files", Dir.pwd)
|
107
107
|
end
|
108
|
-
|
109
|
-
|
108
|
+
|
109
|
+
test "pwd uses standard case conventions" do
|
110
|
+
omit_if(@@java)
|
110
111
|
Dir.chdir("C:\\PROGRAM FILES")
|
111
112
|
assert_equal("C:\\Program Files", Dir.pwd)
|
112
113
|
end
|
113
|
-
|
114
|
-
|
114
|
+
|
115
|
+
test "pwd converts forward slashes to backslashes" do
|
116
|
+
omit_if(@@java)
|
115
117
|
Dir.chdir("C:/Program Files")
|
116
118
|
assert_equal("C:\\Program Files", Dir.pwd)
|
117
119
|
end
|
118
|
-
|
119
|
-
|
120
|
+
|
121
|
+
test "pwd and getwd are aliases" do
|
122
|
+
omit_if(@@java)
|
120
123
|
assert_true(Dir.method(:getwd) == Dir.method(:pwd))
|
121
124
|
end
|
122
125
|
|
123
|
-
|
126
|
+
test "admintools constant is set" do
|
124
127
|
assert_not_nil(Dir::ADMINTOOLS)
|
125
128
|
assert_kind_of(String, Dir::ADMINTOOLS)
|
126
129
|
end
|
127
|
-
|
128
|
-
|
130
|
+
|
131
|
+
test "altstartup constant is set" do
|
129
132
|
assert_not_nil(Dir::ALTSTARTUP)
|
130
133
|
assert_kind_of(String, Dir::ALTSTARTUP)
|
131
134
|
end
|
132
|
-
|
133
|
-
|
135
|
+
|
136
|
+
test "appdata constant is set" do
|
134
137
|
assert_not_nil(Dir::APPDATA)
|
135
138
|
assert_kind_of(String, Dir::APPDATA)
|
136
139
|
end
|
137
|
-
|
138
|
-
|
140
|
+
|
141
|
+
test "bitbucket constant is set" do
|
139
142
|
assert_not_nil(Dir::BITBUCKET)
|
140
143
|
assert_kind_of(String, Dir::BITBUCKET)
|
141
144
|
end
|
142
|
-
|
143
|
-
|
145
|
+
|
146
|
+
test "cdburn area is set" do
|
144
147
|
assert_not_nil(Dir::CDBURN_AREA)
|
145
148
|
assert_kind_of(String, Dir::CDBURN_AREA)
|
146
149
|
end
|
147
|
-
|
148
|
-
|
150
|
+
|
151
|
+
test "common admintools is set" do
|
149
152
|
assert_not_nil(Dir::COMMON_ADMINTOOLS)
|
150
153
|
assert_kind_of(String, Dir::COMMON_ADMINTOOLS)
|
151
154
|
end
|
152
|
-
|
153
|
-
|
155
|
+
|
156
|
+
test "common_altstartup constant is set" do
|
154
157
|
assert_not_nil(Dir::COMMON_ALTSTARTUP)
|
155
158
|
assert_kind_of(String, Dir::COMMON_ALTSTARTUP)
|
156
159
|
end
|
157
|
-
|
158
|
-
|
160
|
+
|
161
|
+
test "common_appdata constant is set" do
|
159
162
|
assert_not_nil(Dir::COMMON_APPDATA)
|
160
163
|
assert_kind_of(String, Dir::COMMON_APPDATA)
|
161
164
|
end
|
162
|
-
|
163
|
-
|
165
|
+
|
166
|
+
test "common desktopdirectory constant is set" do
|
164
167
|
assert_not_nil(Dir::COMMON_DESKTOPDIRECTORY)
|
165
168
|
assert_kind_of(String, Dir::COMMON_DESKTOPDIRECTORY)
|
166
169
|
end
|
167
|
-
|
168
|
-
|
170
|
+
|
171
|
+
test "common_documents constant is set" do
|
169
172
|
assert_not_nil(Dir::COMMON_DOCUMENTS)
|
170
173
|
assert_kind_of(String, Dir::COMMON_DOCUMENTS)
|
171
174
|
end
|
172
|
-
|
173
|
-
|
175
|
+
|
176
|
+
test "common_favorites constant is set" do
|
174
177
|
assert_not_nil(Dir::COMMON_FAVORITES)
|
175
178
|
assert_kind_of(String, Dir::COMMON_FAVORITES)
|
176
179
|
end
|
177
|
-
|
178
|
-
|
180
|
+
|
181
|
+
test "common_music constant is set" do
|
179
182
|
assert_not_nil(Dir::COMMON_MUSIC)
|
180
183
|
assert_kind_of(String, Dir::COMMON_MUSIC)
|
181
184
|
end
|
182
|
-
|
183
|
-
|
185
|
+
|
186
|
+
test "common_pictures constant is set" do
|
184
187
|
assert_not_nil(Dir::COMMON_PICTURES)
|
185
188
|
assert_kind_of(String, Dir::COMMON_PICTURES)
|
186
189
|
end
|
187
|
-
|
188
|
-
|
190
|
+
|
191
|
+
test "common_programs constant is set" do
|
189
192
|
assert_not_nil(Dir::COMMON_PROGRAMS)
|
190
193
|
assert_kind_of(String, Dir::COMMON_PROGRAMS)
|
191
194
|
end
|
192
|
-
|
193
|
-
|
195
|
+
|
196
|
+
test "common_startmenu constant is set" do
|
194
197
|
assert_not_nil(Dir::COMMON_STARTMENU)
|
195
198
|
assert_kind_of(String, Dir::COMMON_STARTMENU)
|
196
199
|
end
|
197
|
-
|
198
|
-
|
200
|
+
|
201
|
+
test "common_startup constant is set" do
|
199
202
|
assert_not_nil(Dir::COMMON_STARTUP)
|
200
203
|
assert_kind_of(String, Dir::COMMON_STARTUP)
|
201
204
|
end
|
202
|
-
|
203
|
-
|
205
|
+
|
206
|
+
test "common_templates constant is set" do
|
204
207
|
assert_not_nil(Dir::COMMON_TEMPLATES)
|
205
208
|
assert_kind_of(String, Dir::COMMON_TEMPLATES)
|
206
209
|
end
|
207
|
-
|
208
|
-
|
210
|
+
|
211
|
+
test "common_video constant is set" do
|
209
212
|
assert_not_nil(Dir::COMMON_VIDEO)
|
210
213
|
assert_kind_of(String, Dir::COMMON_VIDEO)
|
211
214
|
end
|
212
|
-
|
213
|
-
|
215
|
+
|
216
|
+
test "controls constant is set" do
|
214
217
|
assert_not_nil(Dir::CONTROLS)
|
215
218
|
assert_kind_of(String, Dir::CONTROLS)
|
216
219
|
end
|
217
|
-
|
218
|
-
|
220
|
+
|
221
|
+
test "cookies constant is set" do
|
219
222
|
assert_not_nil(Dir::COOKIES)
|
220
223
|
assert_kind_of(String, Dir::COOKIES)
|
221
224
|
end
|
222
|
-
|
223
|
-
|
225
|
+
|
226
|
+
test "desktop constant is set" do
|
224
227
|
assert_not_nil(Dir::DESKTOP)
|
225
228
|
assert_kind_of(String, Dir::DESKTOP)
|
226
229
|
end
|
227
|
-
|
228
|
-
|
230
|
+
|
231
|
+
test "desktopdirectory is set" do
|
229
232
|
assert_not_nil(Dir::DESKTOPDIRECTORY)
|
230
233
|
assert_kind_of(String, Dir::DESKTOPDIRECTORY)
|
231
234
|
end
|
232
|
-
|
233
|
-
|
235
|
+
|
236
|
+
test "drives constant is set" do
|
234
237
|
assert_not_nil(Dir::DRIVES)
|
235
238
|
assert_kind_of(String, Dir::DRIVES)
|
236
239
|
end
|
237
240
|
|
238
|
-
|
241
|
+
test "favorites constant is set" do
|
239
242
|
assert_not_nil(Dir::FAVORITES)
|
240
243
|
assert_kind_of(String, Dir::FAVORITES)
|
241
244
|
end
|
242
|
-
|
243
|
-
|
245
|
+
|
246
|
+
test "fonts constant is set" do
|
244
247
|
assert_not_nil(Dir::FONTS)
|
245
248
|
assert_kind_of(String, Dir::FONTS)
|
246
249
|
end
|
247
|
-
|
248
|
-
|
250
|
+
|
251
|
+
test "history constant is set" do
|
249
252
|
assert_not_nil(Dir::HISTORY)
|
250
253
|
assert_kind_of(String, Dir::HISTORY)
|
251
254
|
end
|
252
|
-
|
253
|
-
|
255
|
+
|
256
|
+
test "internet constant is set" do
|
254
257
|
assert_not_nil(Dir::INTERNET)
|
255
258
|
assert_kind_of(String, Dir::INTERNET)
|
256
259
|
end
|
257
|
-
|
258
|
-
|
260
|
+
|
261
|
+
test "internet_cache constant is set" do
|
259
262
|
assert_not_nil(Dir::INTERNET_CACHE)
|
260
263
|
assert_kind_of(String, Dir::INTERNET_CACHE)
|
261
264
|
end
|
262
|
-
|
263
|
-
|
265
|
+
|
266
|
+
test "local_appdata constant is set" do
|
264
267
|
assert_not_nil(Dir::LOCAL_APPDATA)
|
265
268
|
assert_kind_of(String, Dir::LOCAL_APPDATA)
|
266
269
|
end
|
267
|
-
|
268
|
-
|
270
|
+
|
271
|
+
test "mydocuments constant is set" do
|
269
272
|
assert_not_nil(Dir::MYDOCUMENTS)
|
270
273
|
assert_kind_of(String, Dir::MYDOCUMENTS)
|
271
274
|
end
|
272
|
-
|
273
|
-
|
275
|
+
|
276
|
+
test "mymusic constant is set" do
|
274
277
|
assert_not_nil(Dir::MYMUSIC)
|
275
278
|
assert_kind_of(String, Dir::MYMUSIC)
|
276
279
|
end
|
277
|
-
|
278
|
-
|
280
|
+
|
281
|
+
test "mypictures constant is set" do
|
279
282
|
assert_not_nil(Dir::MYPICTURES)
|
280
283
|
assert_kind_of(String, Dir::MYPICTURES)
|
281
284
|
end
|
282
|
-
|
283
|
-
|
285
|
+
|
286
|
+
test "myvideo constant is set" do
|
284
287
|
assert_not_nil(Dir::MYVIDEO)
|
285
288
|
assert_kind_of(String, Dir::MYVIDEO)
|
286
289
|
end
|
287
|
-
|
288
|
-
|
290
|
+
|
291
|
+
test "nethood constant is set" do
|
289
292
|
assert_not_nil(Dir::NETHOOD)
|
290
293
|
assert_kind_of(String, Dir::NETHOOD)
|
291
294
|
end
|
292
|
-
|
293
|
-
|
295
|
+
|
296
|
+
test "network constant is set" do
|
294
297
|
assert_not_nil(Dir::NETWORK)
|
295
298
|
assert_kind_of(String, Dir::NETWORK)
|
296
299
|
end
|
297
300
|
|
298
|
-
|
301
|
+
test "personal constant is set" do
|
299
302
|
assert_not_nil(Dir::PERSONAL)
|
300
303
|
assert_kind_of(String, Dir::PERSONAL)
|
301
304
|
end
|
302
|
-
|
303
|
-
|
305
|
+
|
306
|
+
test "printers cosntant is set" do
|
304
307
|
assert_not_nil(Dir::PRINTERS)
|
305
308
|
assert_kind_of(String, Dir::PRINTERS)
|
306
309
|
end
|
307
|
-
|
308
|
-
|
310
|
+
|
311
|
+
test "printhood constant is set" do
|
309
312
|
assert_not_nil(Dir::PRINTHOOD)
|
310
313
|
assert_kind_of(String, Dir::PRINTHOOD)
|
311
314
|
end
|
312
|
-
|
313
|
-
|
315
|
+
|
316
|
+
test "profile constant is set" do
|
314
317
|
assert_not_nil(Dir::PROFILE)
|
315
318
|
assert_kind_of(String, Dir::PROFILE)
|
316
319
|
end
|
317
|
-
|
318
|
-
|
319
|
-
#def test_profiles
|
320
|
-
# assert_not_nil(Dir::PROFILES)
|
321
|
-
# assert_kind_of(String,Dir::PROFILES)
|
322
|
-
#end
|
323
|
-
|
324
|
-
def test_program_files
|
320
|
+
|
321
|
+
test "program_files constant is set" do
|
325
322
|
assert_not_nil(Dir::PROGRAM_FILES)
|
326
323
|
assert_kind_of(String, Dir::PROGRAM_FILES)
|
327
324
|
end
|
328
|
-
|
329
|
-
|
325
|
+
|
326
|
+
test "program_files_common constant is set" do
|
330
327
|
assert_not_nil(Dir::PROGRAM_FILES_COMMON)
|
331
328
|
assert_kind_of(String, Dir::PROGRAM_FILES_COMMON)
|
332
329
|
end
|
333
|
-
|
334
|
-
|
330
|
+
|
331
|
+
test "programs constant is set" do
|
335
332
|
assert_not_nil(Dir::PROGRAMS)
|
336
333
|
assert_kind_of(String, Dir::PROGRAMS)
|
337
334
|
end
|
338
|
-
|
339
|
-
|
335
|
+
|
336
|
+
test "recent constant is set" do
|
340
337
|
assert_not_nil(Dir::RECENT)
|
341
338
|
assert_kind_of(String, Dir::RECENT)
|
342
339
|
end
|
343
|
-
|
344
|
-
|
340
|
+
|
341
|
+
test "sendto constant is set" do
|
345
342
|
assert_not_nil(Dir::SENDTO)
|
346
343
|
assert_kind_of(String, Dir::SENDTO)
|
347
344
|
end
|
348
|
-
|
349
|
-
|
345
|
+
|
346
|
+
test "startmenu constant is set" do
|
350
347
|
assert_not_nil(Dir::STARTMENU)
|
351
348
|
assert_kind_of(String, Dir::STARTMENU)
|
352
349
|
end
|
353
|
-
|
354
|
-
|
350
|
+
|
351
|
+
test "startup constant is set" do
|
355
352
|
assert_not_nil(Dir::STARTUP)
|
356
353
|
assert_kind_of(String, Dir::STARTUP)
|
357
354
|
end
|
358
|
-
|
359
|
-
|
355
|
+
|
356
|
+
test "system constant is set" do
|
360
357
|
assert_not_nil(Dir::SYSTEM)
|
361
358
|
assert_kind_of(String, Dir::SYSTEM)
|
362
359
|
end
|
363
|
-
|
364
|
-
|
360
|
+
|
361
|
+
test "templates constant is set" do
|
365
362
|
assert_not_nil(Dir::TEMPLATES)
|
366
363
|
assert_kind_of(String, Dir::TEMPLATES)
|
367
364
|
end
|
368
365
|
|
369
|
-
|
366
|
+
test "windows constant is set" do
|
370
367
|
assert_not_nil(Dir::WINDOWS)
|
371
368
|
assert_kind_of(String, Dir::WINDOWS)
|
372
369
|
end
|
373
370
|
|
371
|
+
test "ffi functions are private" do
|
372
|
+
assert_not_respond_to(Dir, :SHGetFolderPathW)
|
373
|
+
end
|
374
|
+
|
374
375
|
def teardown
|
375
376
|
FileUtils.rm_rf(@ascii_to)
|
376
377
|
FileUtils.rm_rf(@unicode_to)
|
378
|
+
end
|
379
|
+
|
380
|
+
def self.shutdown
|
377
381
|
FileUtils.rm_rf(@@from)
|
382
|
+
@@test_home = nil
|
383
|
+
@@from = nil
|
378
384
|
end
|
379
385
|
end
|