win32-dir 0.3.2 → 0.3.3
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 +8 -0
- data/MANIFEST +2 -2
- data/README +14 -16
- data/Rakefile +5 -2
- data/lib/win32/dir.rb +56 -33
- data/test/{tc_dir.rb → test_dir.rb} +87 -80
- data/win32-dir.gemspec +6 -5
- metadata +54 -47
data/CHANGES
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== 0.3.3 - 30-Mar-2009
|
2
|
+
* Virtual folders like Dir::CONTROL, which were previously almost always nil,
|
3
|
+
are now set to their display name.
|
4
|
+
* Fixed a bug in the create_junction method.
|
5
|
+
* Added an 'example' rake task to run the example code.
|
6
|
+
* Renamed the example program from dir_test.rb to dir_example.rb to prevent
|
7
|
+
any potential confusion that it's a genuine test file.
|
8
|
+
|
1
9
|
== 0.3.2 - 25-Jul-2007
|
2
10
|
* Added a Rakefile with tasks for testing and installation.
|
3
11
|
* Removed the install.rb file (the Rakefile handles installation).
|
data/MANIFEST
CHANGED
data/README
CHANGED
@@ -1,16 +1,12 @@
|
|
1
1
|
= Description
|
2
2
|
A series of extra constants for the Dir class that define special folders
|
3
|
-
on
|
4
|
-
|
3
|
+
on MS Windows systems, as well as methods for creating and detecting
|
4
|
+
junctions, i.e. symlinks for directories.
|
5
5
|
|
6
6
|
= Installation
|
7
7
|
rake test (optional)
|
8
8
|
rake install (non-gem) or rake install_gem (gem).
|
9
9
|
|
10
|
-
= Notes
|
11
|
-
Some tests may fail. That is expected, because not all constants are
|
12
|
-
necessarily defined on your system.
|
13
|
-
|
14
10
|
= Synopsis
|
15
11
|
require "win32/dir"
|
16
12
|
|
@@ -41,9 +37,9 @@ Dir::COMMON_ADMINTOOLS
|
|
41
37
|
Dir::APPDATA
|
42
38
|
The file system directory that serves as a common repository for
|
43
39
|
application-specific data. A typical path is
|
44
|
-
C:\Documents and Settings
|
40
|
+
C:\Documents and Settings\<user>\Application Data.
|
45
41
|
|
46
|
-
This CSIDL is supported by the redistributable
|
42
|
+
This CSIDL is supported by the redistributable shfolder.dll for
|
47
43
|
systems that do not have the Microsoft Internet Explorer 4.0
|
48
44
|
integrated Shell installed.
|
49
45
|
|
@@ -57,7 +53,7 @@ Dir::COMMON_DOCUMENTS
|
|
57
53
|
|
58
54
|
Dir::COOKIES
|
59
55
|
The file system directory that serves as a common repository for Internet
|
60
|
-
cookies. A typical path is C:\Documents and Settings
|
56
|
+
cookies. A typical path is C:\Documents and Settings\<user>\Cookies.
|
61
57
|
|
62
58
|
Dir::HISTORY
|
63
59
|
The file system directory that serves as a common repository for Internet
|
@@ -66,17 +62,17 @@ Dir::HISTORY
|
|
66
62
|
Dir::INTERNET_CACHE
|
67
63
|
The file system directory that serves as a common repository for temporary
|
68
64
|
Internet files. A typical path is
|
69
|
-
C:\Documents and Settings
|
65
|
+
C:\Documents and Settings\<user>\Local Settings\Temporary Internet Files.
|
70
66
|
|
71
67
|
Dir::LOCAL_APPDATA
|
72
68
|
The file system directory that serves as a data repository for local
|
73
69
|
(nonroaming) applications. A typical path is
|
74
|
-
C:\Documents and Settings
|
70
|
+
C:\Documents and Settings\<user>\Local Settings\Application Data.
|
75
71
|
|
76
72
|
Dir::MYPICTURES
|
77
73
|
The file system directory that serves as a common repository for image
|
78
74
|
files. A typical path is
|
79
|
-
C:\Documents and Settings
|
75
|
+
C:\Documents and Settings\<user>\My Documents\My Pictures.
|
80
76
|
|
81
77
|
Dir::PERSONAL
|
82
78
|
The virtual folder representing the My Documents desktop item. This is
|
@@ -97,7 +93,7 @@ Dir::WINDOWS
|
|
97
93
|
%SYSTEMROOT% environment variables. A typical path is C:\Windows.
|
98
94
|
|
99
95
|
== The following constants may or may not be defined:
|
100
|
-
|
96
|
+
Dir::ALTSTARTUP
|
101
97
|
The file system directory that corresponds to the user's nonlocalized
|
102
98
|
Startup program group.
|
103
99
|
|
@@ -234,8 +230,10 @@ Dir::TEMPLATES
|
|
234
230
|
== Developer's Notes
|
235
231
|
The SHGetFolderPath() documentation on MSDN is somewhat vague about which
|
236
232
|
CSIDL constants are guaranteed to be defined. However, there are 15 which
|
237
|
-
*should* be defined (see docs above). The rest I cannot vouch for.
|
238
|
-
|
233
|
+
*should* be defined (see docs above). The rest I cannot vouch for.
|
234
|
+
|
235
|
+
Some of these folders are virtual, and the value will be the display name
|
236
|
+
only instead of an actual path.
|
239
237
|
|
240
238
|
== Known Bugs
|
241
239
|
The Unicode support is not quite there for Dir.create_junction. It creates
|
@@ -263,7 +261,7 @@ Dir::TEMPLATES
|
|
263
261
|
Ruby's
|
264
262
|
|
265
263
|
== Copyright
|
266
|
-
(C) 2003-
|
264
|
+
(C) 2003-2008 Daniel J. Berger, All Rights Reserved
|
267
265
|
|
268
266
|
== Warranty
|
269
267
|
This package is provided "as is" and without any express or
|
data/Rakefile
CHANGED
@@ -15,8 +15,11 @@ task :install_gem do
|
|
15
15
|
sh "gem install #{file}"
|
16
16
|
end
|
17
17
|
|
18
|
+
desc "Run the example program"
|
19
|
+
task :example do
|
20
|
+
sh "ruby -Ilib examples/dir_example.rb"
|
21
|
+
|
18
22
|
Rake::TestTask.new do |t|
|
19
|
-
t.libs << 'lib'
|
20
23
|
t.warning = true
|
21
|
-
t.
|
24
|
+
t.verbose = true
|
22
25
|
end
|
data/lib/win32/dir.rb
CHANGED
@@ -7,6 +7,8 @@ require 'windows/unicode'
|
|
7
7
|
require 'windows/directory'
|
8
8
|
require 'windows/handle'
|
9
9
|
require 'windows/path'
|
10
|
+
require 'windows/limits'
|
11
|
+
require 'windows/system_info'
|
10
12
|
|
11
13
|
class Dir
|
12
14
|
include Windows::Directory
|
@@ -14,6 +16,8 @@ class Dir
|
|
14
16
|
include Windows::Error
|
15
17
|
include Windows::File
|
16
18
|
include Windows::DeviceIO
|
19
|
+
include Windows::Limits
|
20
|
+
|
17
21
|
extend Windows::Directory
|
18
22
|
extend Windows::Shell
|
19
23
|
extend Windows::File
|
@@ -22,12 +26,14 @@ class Dir
|
|
22
26
|
extend Windows::Unicode
|
23
27
|
extend Windows::Handle
|
24
28
|
extend Windows::Path
|
29
|
+
extend Windows::Limits
|
30
|
+
extend Windows::SystemInfo
|
25
31
|
|
26
|
-
VERSION = '0.3.
|
32
|
+
VERSION = '0.3.3'
|
27
33
|
|
28
34
|
# Dynamically set each of the CSIDL_ constants
|
29
35
|
constants.grep(/CSIDL/).each{ |constant|
|
30
|
-
path = 0.chr *
|
36
|
+
path = 0.chr * MAXPATH
|
31
37
|
nconst = constant.split('CSIDL_').last
|
32
38
|
|
33
39
|
if SHGetFolderPath(0, const_get(constant), 0, 1, path) != 0
|
@@ -35,21 +41,37 @@ class Dir
|
|
35
41
|
else
|
36
42
|
path.strip!
|
37
43
|
end
|
38
|
-
|
39
|
-
|
44
|
+
|
45
|
+
# Try another approach for virtual folders
|
46
|
+
if path.nil?
|
47
|
+
ppidl = 0.chr * 4 # PIDLIST_ABSOLUTE
|
48
|
+
|
49
|
+
if SHGetFolderLocation(0, const_get(constant), 0, 0, ppidl) == S_OK
|
50
|
+
info = 0.chr * 692 # sizeof(SHFILEINFO)
|
51
|
+
flags = SHGFI_DISPLAYNAME | SHGFI_PIDL
|
52
|
+
SHGetFileInfo(ppidl.unpack('L')[0], 0, info, 692, flags)
|
53
|
+
path = info[12..-1].strip
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
Dir.const_set(nconst, path) if path
|
40
58
|
}
|
41
|
-
|
59
|
+
|
60
|
+
# Set Dir::MYDOCUMENTS to the same as Dir::PERSONAL if undefined
|
61
|
+
unless defined? MYDOCUMENTS
|
62
|
+
MYDOCUMENTS = PERSONAL
|
63
|
+
end
|
64
|
+
|
42
65
|
# Creates the symlink +to+, linked to the existing directory +from+. If the
|
43
66
|
# +to+ directory already exists, it must be empty or an error is raised.
|
44
67
|
#
|
45
68
|
def self.create_junction(to, from)
|
46
|
-
# Normalize
|
47
|
-
|
48
|
-
from.tr!('/', "\\")
|
69
|
+
to = to.tr(File::SEPARATOR, File::ALT_SEPARATOR) # Normalize path
|
70
|
+
from = from.tr(File::SEPARATOR, File::ALT_SEPARATOR) # Normalize path
|
49
71
|
|
50
|
-
to_path = 0.chr *
|
51
|
-
from_path = 0.chr *
|
52
|
-
buf_target = 0.chr *
|
72
|
+
to_path = 0.chr * MAXPATH
|
73
|
+
from_path = 0.chr * MAXPATH
|
74
|
+
buf_target = 0.chr * MAXPATH
|
53
75
|
|
54
76
|
if GetFullPathName(from, from_path.size, from_path, 0) == 0
|
55
77
|
raise StandardError, 'GetFullPathName() failed: ' + get_last_error
|
@@ -65,6 +87,7 @@ class Dir
|
|
65
87
|
# You can create a junction to a directory that already exists, so
|
66
88
|
# long as it's empty.
|
67
89
|
rv = CreateDirectory(to_path, 0)
|
90
|
+
|
68
91
|
if rv == 0 && rv != ERROR_ALREADY_EXISTS
|
69
92
|
raise StandardError, 'CreateDirectory() failed: ' + get_last_error
|
70
93
|
end
|
@@ -84,9 +107,8 @@ class Dir
|
|
84
107
|
end
|
85
108
|
|
86
109
|
buf_target = buf_target.split(0.chr).first
|
87
|
-
buf_target = "\\??\\" << from_path
|
88
|
-
|
89
|
-
wide_string = multi_to_wide(buf_target)
|
110
|
+
buf_target = "\\??\\" << from_path
|
111
|
+
wide_string = multi_to_wide(buf_target)[0..-3]
|
90
112
|
|
91
113
|
# REPARSE_JDATA_BUFFER
|
92
114
|
rdb = [
|
@@ -102,26 +124,27 @@ class Dir
|
|
102
124
|
|
103
125
|
bytes = [0].pack('L')
|
104
126
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
127
|
+
begin
|
128
|
+
bool = DeviceIoControl(
|
129
|
+
handle,
|
130
|
+
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, 0),
|
131
|
+
rdb,
|
132
|
+
rdb.size,
|
133
|
+
0,
|
134
|
+
0,
|
135
|
+
bytes,
|
136
|
+
0
|
137
|
+
)
|
138
|
+
|
139
|
+
unless bool
|
140
|
+
error = 'DeviceIoControl() failed: ' + get_last_error
|
141
|
+
RemoveDirectory(to_path)
|
142
|
+
raise error
|
143
|
+
end
|
144
|
+
ensure
|
145
|
+
CloseHandle(handle)
|
121
146
|
end
|
122
147
|
|
123
|
-
CloseHandle(handle)
|
124
|
-
|
125
148
|
self
|
126
149
|
end
|
127
150
|
|
@@ -150,4 +173,4 @@ class Dir
|
|
150
173
|
class << self
|
151
174
|
alias reparse_dir? junction?
|
152
175
|
end
|
153
|
-
end
|
176
|
+
end
|
@@ -1,252 +1,259 @@
|
|
1
1
|
###########################################################################
|
2
|
-
#
|
2
|
+
# test_dir.rb
|
3
3
|
#
|
4
|
-
# Test suite for the win32-dir
|
5
|
-
#
|
6
|
-
# your operating system and version of certain DLL files.
|
7
|
-
#
|
8
|
-
# You should run this test case via the 'rake test' task.
|
4
|
+
# Test suite for the win32-dir library. You should run this test case
|
5
|
+
# via the 'rake test' task.
|
9
6
|
###########################################################################
|
7
|
+
require 'rubygems'
|
8
|
+
gem 'test-unit'
|
9
|
+
|
10
10
|
require 'test/unit'
|
11
11
|
require 'win32/dir'
|
12
12
|
require 'fileutils'
|
13
13
|
|
14
|
-
puts "Some tests may fail because some constants aren't defined on your system."
|
15
|
-
puts "This is not unexpected."
|
16
|
-
|
17
14
|
class TC_Win32_Dir < Test::Unit::TestCase
|
15
|
+
def self.startup
|
16
|
+
Dir.chdir('test') unless File.basename(Dir.pwd) == 'test'
|
17
|
+
@@from = File.join(Dir.pwd, "test_from_directory")
|
18
|
+
end
|
19
|
+
|
18
20
|
def setup
|
19
|
-
@
|
20
|
-
@ascii_to = "to"
|
21
|
+
@ascii_to = "test_to_directory"
|
21
22
|
@unicode_to = "Ελλάσ" # Greek - the word is 'Hellas'
|
22
|
-
|
23
|
+
@test_file = File.join(@@from, "test.txt")
|
24
|
+
Dir.mkdir(@@from)
|
23
25
|
end
|
24
26
|
|
25
27
|
def test_version
|
26
|
-
assert_equal('0.3.
|
28
|
+
assert_equal('0.3.3', Dir::VERSION)
|
27
29
|
end
|
28
30
|
|
29
|
-
def
|
31
|
+
def test_create_junction_basic
|
30
32
|
assert_respond_to(Dir, :create_junction)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_create_junction_ascii
|
36
|
+
assert_nothing_raised{ Dir.create_junction(@ascii_to, @@from) }
|
37
|
+
File.open(@test_file, 'w'){ |fh| fh.puts "Hello World" }
|
38
|
+
assert_equal(Dir.entries(@@from), Dir.entries(@ascii_to))
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_create_junction_unicode
|
42
|
+
assert_nothing_raised{ Dir.create_junction(@unicode_to, @@from) }
|
43
|
+
File.open(@test_file, 'w'){ |fh| fh.puts "Hello World" }
|
44
|
+
assert_equal(Dir.entries(@@from), Dir.entries(@unicode_to))
|
40
45
|
end
|
41
46
|
|
42
47
|
def test_is_junction
|
43
48
|
assert_respond_to(Dir, :junction?)
|
44
|
-
|
45
|
-
|
46
|
-
assert_nothing_raised{ Dir.create_junction(@ascii_to, @from) }
|
47
|
-
|
48
|
-
assert_equal(false, Dir.junction?(@from))
|
49
|
+
assert_nothing_raised{ Dir.create_junction(@ascii_to, @@from) }
|
50
|
+
assert_equal(false, Dir.junction?(@@from))
|
49
51
|
assert_equal(true, Dir.junction?(@ascii_to))
|
50
52
|
end
|
53
|
+
|
54
|
+
def test_reparse_dir_alias
|
55
|
+
assert_respond_to(Dir, :reparse_dir?) # alias
|
56
|
+
assert_equal(true, Dir.method(:reparse_dir?) == Dir.method(:junction?))
|
57
|
+
end
|
51
58
|
|
52
59
|
def test_is_empty
|
53
60
|
assert_respond_to(Dir, :empty?)
|
54
|
-
assert_equal(false, Dir.empty?("C:\\")) # One would
|
55
|
-
assert_equal(true, Dir.empty?(
|
61
|
+
assert_equal(false, Dir.empty?("C:\\")) # One would think
|
62
|
+
assert_equal(true, Dir.empty?(@@from))
|
56
63
|
end
|
57
64
|
|
58
65
|
def test_admintools
|
59
|
-
assert_not_nil(Dir::ADMINTOOLS
|
66
|
+
assert_not_nil(Dir::ADMINTOOLS)
|
60
67
|
assert_kind_of(String, Dir::ADMINTOOLS)
|
61
68
|
end
|
62
69
|
|
63
70
|
def test_altstartup
|
64
|
-
assert_not_nil(Dir::ALTSTARTUP
|
71
|
+
assert_not_nil(Dir::ALTSTARTUP)
|
65
72
|
assert_kind_of(String, Dir::ALTSTARTUP)
|
66
73
|
end
|
67
74
|
|
68
75
|
def test_appdata
|
69
|
-
assert_not_nil(Dir::APPDATA
|
76
|
+
assert_not_nil(Dir::APPDATA)
|
70
77
|
assert_kind_of(String, Dir::APPDATA)
|
71
78
|
end
|
72
79
|
|
73
80
|
def test_bitbucket
|
74
|
-
assert_not_nil(Dir::BITBUCKET
|
81
|
+
assert_not_nil(Dir::BITBUCKET)
|
75
82
|
assert_kind_of(String, Dir::BITBUCKET)
|
76
83
|
end
|
77
84
|
|
78
85
|
def test_cdburn_area
|
79
|
-
assert_not_nil(Dir::CDBURN_AREA
|
86
|
+
assert_not_nil(Dir::CDBURN_AREA)
|
80
87
|
assert_kind_of(String, Dir::CDBURN_AREA)
|
81
88
|
end
|
82
89
|
|
83
90
|
def test_common_admintools
|
84
|
-
assert_not_nil(Dir::COMMON_ADMINTOOLS
|
91
|
+
assert_not_nil(Dir::COMMON_ADMINTOOLS)
|
85
92
|
assert_kind_of(String, Dir::COMMON_ADMINTOOLS)
|
86
93
|
end
|
87
94
|
|
88
95
|
def test_common_altstartup
|
89
|
-
assert_not_nil(Dir::COMMON_ALTSTARTUP
|
96
|
+
assert_not_nil(Dir::COMMON_ALTSTARTUP)
|
90
97
|
assert_kind_of(String, Dir::COMMON_ALTSTARTUP)
|
91
98
|
end
|
92
99
|
|
93
100
|
def test_common_appdata
|
94
|
-
assert_not_nil(Dir::COMMON_APPDATA
|
101
|
+
assert_not_nil(Dir::COMMON_APPDATA)
|
95
102
|
assert_kind_of(String, Dir::COMMON_APPDATA)
|
96
103
|
end
|
97
104
|
|
98
105
|
def test_common_desktopdirectory
|
99
|
-
assert_not_nil(Dir::COMMON_DESKTOPDIRECTORY
|
106
|
+
assert_not_nil(Dir::COMMON_DESKTOPDIRECTORY)
|
100
107
|
assert_kind_of(String, Dir::COMMON_DESKTOPDIRECTORY)
|
101
108
|
end
|
102
109
|
|
103
110
|
def test_common_documents
|
104
|
-
assert_not_nil(Dir::COMMON_DOCUMENTS
|
111
|
+
assert_not_nil(Dir::COMMON_DOCUMENTS)
|
105
112
|
assert_kind_of(String, Dir::COMMON_DOCUMENTS)
|
106
113
|
end
|
107
114
|
|
108
115
|
def test_common_favorites
|
109
|
-
assert_not_nil(Dir::COMMON_FAVORITES
|
116
|
+
assert_not_nil(Dir::COMMON_FAVORITES)
|
110
117
|
assert_kind_of(String, Dir::COMMON_FAVORITES)
|
111
118
|
end
|
112
119
|
|
113
120
|
def test_common_music
|
114
|
-
assert_not_nil(Dir::COMMON_MUSIC
|
121
|
+
assert_not_nil(Dir::COMMON_MUSIC)
|
115
122
|
assert_kind_of(String, Dir::COMMON_MUSIC)
|
116
123
|
end
|
117
124
|
|
118
125
|
def test_common_pictures
|
119
|
-
assert_not_nil(Dir::COMMON_PICTURES
|
126
|
+
assert_not_nil(Dir::COMMON_PICTURES)
|
120
127
|
assert_kind_of(String, Dir::COMMON_PICTURES)
|
121
128
|
end
|
122
129
|
|
123
130
|
def test_common_programs
|
124
|
-
assert_not_nil(Dir::COMMON_PROGRAMS
|
131
|
+
assert_not_nil(Dir::COMMON_PROGRAMS)
|
125
132
|
assert_kind_of(String, Dir::COMMON_PROGRAMS)
|
126
133
|
end
|
127
134
|
|
128
135
|
def test_common_startmenu
|
129
|
-
assert_not_nil(Dir::COMMON_STARTMENU
|
136
|
+
assert_not_nil(Dir::COMMON_STARTMENU)
|
130
137
|
assert_kind_of(String, Dir::COMMON_STARTMENU)
|
131
138
|
end
|
132
139
|
|
133
140
|
def test_common_startup
|
134
|
-
assert_not_nil(Dir::COMMON_STARTUP
|
141
|
+
assert_not_nil(Dir::COMMON_STARTUP)
|
135
142
|
assert_kind_of(String, Dir::COMMON_STARTUP)
|
136
143
|
end
|
137
144
|
|
138
145
|
def test_common_templates
|
139
|
-
assert_not_nil(Dir::COMMON_TEMPLATES
|
146
|
+
assert_not_nil(Dir::COMMON_TEMPLATES)
|
140
147
|
assert_kind_of(String, Dir::COMMON_TEMPLATES)
|
141
148
|
end
|
142
149
|
|
143
150
|
def test_common_video
|
144
|
-
assert_not_nil(Dir::COMMON_VIDEO
|
151
|
+
assert_not_nil(Dir::COMMON_VIDEO)
|
145
152
|
assert_kind_of(String, Dir::COMMON_VIDEO)
|
146
153
|
end
|
147
154
|
|
148
155
|
def test_controls
|
149
|
-
assert_not_nil(Dir::CONTROLS
|
156
|
+
assert_not_nil(Dir::CONTROLS)
|
150
157
|
assert_kind_of(String, Dir::CONTROLS)
|
151
158
|
end
|
152
159
|
|
153
160
|
def test_cookies
|
154
|
-
assert_not_nil(Dir::COOKIES
|
161
|
+
assert_not_nil(Dir::COOKIES)
|
155
162
|
assert_kind_of(String, Dir::COOKIES)
|
156
163
|
end
|
157
164
|
|
158
165
|
def test_desktop
|
159
|
-
assert_not_nil(Dir::DESKTOP
|
166
|
+
assert_not_nil(Dir::DESKTOP)
|
160
167
|
assert_kind_of(String, Dir::DESKTOP)
|
161
168
|
end
|
162
169
|
|
163
170
|
def test_desktopdirectory
|
164
|
-
assert_not_nil(Dir::DESKTOPDIRECTORY
|
171
|
+
assert_not_nil(Dir::DESKTOPDIRECTORY)
|
165
172
|
assert_kind_of(String, Dir::DESKTOPDIRECTORY)
|
166
173
|
end
|
167
174
|
|
168
175
|
def test_drives
|
169
|
-
assert_not_nil(Dir::DRIVES
|
176
|
+
assert_not_nil(Dir::DRIVES)
|
170
177
|
assert_kind_of(String, Dir::DRIVES)
|
171
178
|
end
|
172
179
|
|
173
180
|
def test_favorites
|
174
|
-
assert_not_nil(Dir::FAVORITES
|
181
|
+
assert_not_nil(Dir::FAVORITES)
|
175
182
|
assert_kind_of(String, Dir::FAVORITES)
|
176
183
|
end
|
177
184
|
|
178
185
|
def test_fonts
|
179
|
-
assert_not_nil(Dir::FONTS
|
186
|
+
assert_not_nil(Dir::FONTS)
|
180
187
|
assert_kind_of(String, Dir::FONTS)
|
181
188
|
end
|
182
189
|
|
183
190
|
def test_history
|
184
|
-
assert_not_nil(Dir::HISTORY
|
191
|
+
assert_not_nil(Dir::HISTORY)
|
185
192
|
assert_kind_of(String, Dir::HISTORY)
|
186
193
|
end
|
187
194
|
|
188
195
|
def test_internet
|
189
|
-
assert_not_nil(Dir::INTERNET
|
196
|
+
assert_not_nil(Dir::INTERNET)
|
190
197
|
assert_kind_of(String, Dir::INTERNET)
|
191
198
|
end
|
192
199
|
|
193
200
|
def test_internet_cache
|
194
|
-
assert_not_nil(Dir::INTERNET_CACHE
|
201
|
+
assert_not_nil(Dir::INTERNET_CACHE)
|
195
202
|
assert_kind_of(String, Dir::INTERNET_CACHE)
|
196
203
|
end
|
197
204
|
|
198
205
|
def test_local_appdata
|
199
|
-
assert_not_nil(Dir::LOCAL_APPDATA
|
206
|
+
assert_not_nil(Dir::LOCAL_APPDATA)
|
200
207
|
assert_kind_of(String, Dir::LOCAL_APPDATA)
|
201
208
|
end
|
202
209
|
|
203
210
|
def test_mydocuments
|
204
|
-
assert_not_nil(Dir::MYDOCUMENTS
|
211
|
+
assert_not_nil(Dir::MYDOCUMENTS)
|
205
212
|
assert_kind_of(String, Dir::MYDOCUMENTS)
|
206
213
|
end
|
207
214
|
|
208
215
|
def test_local_mymusic
|
209
|
-
assert_not_nil(Dir::MYMUSIC
|
216
|
+
assert_not_nil(Dir::MYMUSIC)
|
210
217
|
assert_kind_of(String, Dir::MYMUSIC)
|
211
218
|
end
|
212
219
|
|
213
220
|
def test_local_mypictures
|
214
|
-
assert_not_nil(Dir::MYPICTURES
|
221
|
+
assert_not_nil(Dir::MYPICTURES)
|
215
222
|
assert_kind_of(String, Dir::MYPICTURES)
|
216
223
|
end
|
217
224
|
|
218
225
|
def test_local_myvideo
|
219
|
-
assert_not_nil(Dir::MYVIDEO
|
226
|
+
assert_not_nil(Dir::MYVIDEO)
|
220
227
|
assert_kind_of(String, Dir::MYVIDEO)
|
221
228
|
end
|
222
229
|
|
223
230
|
def test_nethood
|
224
|
-
assert_not_nil(Dir::NETHOOD
|
231
|
+
assert_not_nil(Dir::NETHOOD)
|
225
232
|
assert_kind_of(String, Dir::NETHOOD)
|
226
233
|
end
|
227
234
|
|
228
235
|
def test_network
|
229
|
-
assert_not_nil(Dir::NETWORK
|
236
|
+
assert_not_nil(Dir::NETWORK)
|
230
237
|
assert_kind_of(String, Dir::NETWORK)
|
231
238
|
end
|
232
239
|
|
233
240
|
def test_personal
|
234
|
-
assert_not_nil(Dir::PERSONAL
|
241
|
+
assert_not_nil(Dir::PERSONAL)
|
235
242
|
assert_kind_of(String, Dir::PERSONAL)
|
236
243
|
end
|
237
244
|
|
238
245
|
def test_printers
|
239
|
-
assert_not_nil(Dir::PRINTERS
|
246
|
+
assert_not_nil(Dir::PRINTERS)
|
240
247
|
assert_kind_of(String, Dir::PRINTERS)
|
241
248
|
end
|
242
249
|
|
243
250
|
def test_printhood
|
244
|
-
assert_not_nil(Dir::PRINTHOOD
|
251
|
+
assert_not_nil(Dir::PRINTHOOD)
|
245
252
|
assert_kind_of(String, Dir::PRINTHOOD)
|
246
253
|
end
|
247
254
|
|
248
255
|
def test_profile
|
249
|
-
assert_not_nil(Dir::PROFILE
|
256
|
+
assert_not_nil(Dir::PROFILE)
|
250
257
|
assert_kind_of(String, Dir::PROFILE)
|
251
258
|
end
|
252
259
|
|
@@ -257,58 +264,58 @@ class TC_Win32_Dir < Test::Unit::TestCase
|
|
257
264
|
#end
|
258
265
|
|
259
266
|
def test_program_files
|
260
|
-
assert_not_nil(Dir::PROGRAM_FILES
|
267
|
+
assert_not_nil(Dir::PROGRAM_FILES)
|
261
268
|
assert_kind_of(String, Dir::PROGRAM_FILES)
|
262
269
|
end
|
263
270
|
|
264
271
|
def test_program_files_common
|
265
|
-
assert_not_nil(Dir::PROGRAM_FILES_COMMON
|
272
|
+
assert_not_nil(Dir::PROGRAM_FILES_COMMON)
|
266
273
|
assert_kind_of(String, Dir::PROGRAM_FILES_COMMON)
|
267
274
|
end
|
268
275
|
|
269
276
|
def test_programs
|
270
|
-
assert_not_nil(Dir::PROGRAMS
|
277
|
+
assert_not_nil(Dir::PROGRAMS)
|
271
278
|
assert_kind_of(String, Dir::PROGRAMS)
|
272
279
|
end
|
273
280
|
|
274
281
|
def test_recent
|
275
|
-
assert_not_nil(Dir::RECENT
|
282
|
+
assert_not_nil(Dir::RECENT)
|
276
283
|
assert_kind_of(String, Dir::RECENT)
|
277
284
|
end
|
278
285
|
|
279
286
|
def test_sendto
|
280
|
-
assert_not_nil(Dir::SENDTO
|
287
|
+
assert_not_nil(Dir::SENDTO)
|
281
288
|
assert_kind_of(String, Dir::SENDTO)
|
282
289
|
end
|
283
290
|
|
284
291
|
def test_startmenu
|
285
|
-
assert_not_nil(Dir::STARTMENU
|
292
|
+
assert_not_nil(Dir::STARTMENU)
|
286
293
|
assert_kind_of(String, Dir::STARTMENU)
|
287
294
|
end
|
288
295
|
|
289
296
|
def test_startup
|
290
|
-
assert_not_nil(Dir::STARTUP
|
297
|
+
assert_not_nil(Dir::STARTUP)
|
291
298
|
assert_kind_of(String, Dir::STARTUP)
|
292
299
|
end
|
293
300
|
|
294
301
|
def test_system
|
295
|
-
assert_not_nil(Dir::SYSTEM
|
302
|
+
assert_not_nil(Dir::SYSTEM)
|
296
303
|
assert_kind_of(String, Dir::SYSTEM)
|
297
304
|
end
|
298
305
|
|
299
306
|
def test_templates
|
300
|
-
assert_not_nil(Dir::TEMPLATES
|
307
|
+
assert_not_nil(Dir::TEMPLATES)
|
301
308
|
assert_kind_of(String, Dir::TEMPLATES)
|
302
309
|
end
|
303
310
|
|
304
311
|
def test_windows_dir
|
305
|
-
assert_not_nil(Dir::WINDOWS
|
312
|
+
assert_not_nil(Dir::WINDOWS)
|
306
313
|
assert_kind_of(String, Dir::WINDOWS)
|
307
314
|
end
|
308
315
|
|
309
316
|
def teardown
|
310
317
|
FileUtils.rm_rf(@ascii_to)
|
311
318
|
FileUtils.rm_rf(@unicode_to)
|
312
|
-
FileUtils.rm_rf(
|
319
|
+
FileUtils.rm_rf(@@from)
|
313
320
|
end
|
314
321
|
end
|
data/win32-dir.gemspec
CHANGED
@@ -2,23 +2,24 @@ require "rubygems"
|
|
2
2
|
|
3
3
|
spec = Gem::Specification.new do |gem|
|
4
4
|
gem.name = "win32-dir"
|
5
|
-
gem.version = "0.3.
|
6
|
-
gem.
|
5
|
+
gem.version = "0.3.3"
|
6
|
+
gem.authors = ["Daniel J. Berger", "Park Heesob"]
|
7
7
|
gem.email = "djberg96@gmail.com"
|
8
8
|
gem.homepage = "http://www.rubyforge.org/projects/win32utils"
|
9
9
|
gem.platform = Gem::Platform::RUBY
|
10
10
|
gem.summary = "Extra constants and methods for the Dir class on Windows."
|
11
11
|
gem.description = "Extra constants and methods for the Dir class on Windows."
|
12
|
-
gem.test_file = "test/
|
12
|
+
gem.test_file = "test/test_dir.rb"
|
13
13
|
gem.has_rdoc = true
|
14
14
|
gem.files = Dir["lib/win32/*.rb"] + Dir["test/*"] + Dir["[A-Z]*"]
|
15
15
|
gem.files.reject! { |fn| fn.include? "CVS" }
|
16
16
|
gem.require_path = "lib"
|
17
17
|
gem.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
|
18
|
-
gem.add_dependency("windows-pr", ">= 0.
|
18
|
+
gem.add_dependency("windows-pr", ">= 0.9.3")
|
19
|
+
gem.rubyforge_project = "win32utils"
|
19
20
|
end
|
20
21
|
|
21
22
|
if $0 == __FILE__
|
22
|
-
Gem.manage_gems
|
23
|
+
Gem.manage_gems if Gem::RubyGemsVersion.to_f < 1.0
|
23
24
|
Gem::Builder.new(spec).build
|
24
25
|
end
|
metadata
CHANGED
@@ -1,39 +1,42 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.2
|
3
|
-
specification_version: 1
|
4
2
|
name: win32-dir
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.3.
|
7
|
-
date: 2007-07-25 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:
|
4
|
+
version: 0.3.3
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- Daniel J. Berger
|
8
|
+
- Park Heesob
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-03-30 00:00:00 -06:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: windows-pr
|
18
|
+
type: :runtime
|
19
|
+
version_requirement:
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.9.3
|
25
|
+
version:
|
26
|
+
description: Extra constants and methods for the Dir class on Windows.
|
27
|
+
email: djberg96@gmail.com
|
28
|
+
executables: []
|
29
|
+
|
30
|
+
extensions: []
|
31
|
+
|
32
|
+
extra_rdoc_files:
|
33
|
+
- README
|
34
|
+
- CHANGES
|
35
|
+
- MANIFEST
|
31
36
|
files:
|
32
37
|
- lib/win32/dir.rb
|
33
|
-
- test/
|
34
|
-
- test/tc_dir.rb
|
38
|
+
- test/test_dir.rb
|
35
39
|
- CHANGES
|
36
|
-
- CVS
|
37
40
|
- examples
|
38
41
|
- lib
|
39
42
|
- MANIFEST
|
@@ -41,27 +44,31 @@ files:
|
|
41
44
|
- README
|
42
45
|
- test
|
43
46
|
- win32-dir.gemspec
|
44
|
-
|
45
|
-
|
47
|
+
has_rdoc: true
|
48
|
+
homepage: http://www.rubyforge.org/projects/win32utils
|
49
|
+
post_install_message:
|
46
50
|
rdoc_options: []
|
47
51
|
|
48
|
-
|
49
|
-
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: "0"
|
59
|
+
version:
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: "0"
|
65
|
+
version:
|
56
66
|
requirements: []
|
57
67
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: 0.5.1
|
67
|
-
version:
|
68
|
+
rubyforge_project: win32utils
|
69
|
+
rubygems_version: 1.3.1
|
70
|
+
signing_key:
|
71
|
+
specification_version: 2
|
72
|
+
summary: Extra constants and methods for the Dir class on Windows.
|
73
|
+
test_files:
|
74
|
+
- test/test_dir.rb
|