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/CHANGES CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.3.6 - 6-Feb-2010
2
+ * Bug fixes for Ruby 1.9.x. Thanks go to Kendall Gifford for the spot and
3
+ the patch.
4
+ * Minor refactoring of the Dir.create_junction method. This fixed a bug for
5
+ Ruby 1.9.x, but was also a little cleaner in general.
6
+ * Some Rakefile task and gemspec updates.
7
+
1
8
  == 0.3.5 - 6-Aug-2009
2
9
  * Changed the license to Artistic 2.0.
3
10
  * Updated the gemspec, including the addition of a license attribute and
@@ -38,4 +45,4 @@
38
45
  * Added corresponding tests and documentation.
39
46
 
40
47
  == 0.1.0 - 25-Feb-2005
41
- * Initial release
48
+ * Initial release
data/MANIFEST CHANGED
@@ -5,4 +5,4 @@
5
5
  * win32-dir.gemspec
6
6
  * examples/dir_example.rb
7
7
  * lib/win32/dir.rb
8
- * test/test_dir.rb
8
+ * test/test_win32_dir.rb
data/README CHANGED
@@ -1,273 +1,270 @@
1
1
  = Description
2
- A series of extra constants for the Dir class that define special folders
3
- on MS Windows systems, as well as methods for creating and detecting
4
- junctions, i.e. symlinks for directories.
2
+ A series of extra constants for the Dir class that define special folders
3
+ on MS Windows systems, as well as methods for creating and detecting
4
+ junctions, i.e. symlinks for directories.
5
5
 
6
6
  = Installation
7
- rake test (optional)
8
- rake install (non-gem) or rake install_gem (gem).
7
+ gem install win32-dir
9
8
 
10
9
  = Synopsis
11
- require "win32/dir"
10
+ require 'win32/dir'
12
11
 
13
- # C:\WINNT or C:\WINDOWS
14
- puts Dir::WINDOWS
12
+ # C:\WINNT or C:\WINDOWS
13
+ puts Dir::WINDOWS
15
14
 
16
- # C:\Documents and Settings\Daniel\Start Menu\Programs\Administrative Tools
17
- puts Dir::ADMINTOOLS
15
+ # C:\Documents and Settings\Daniel\Start Menu\Programs\Administrative Tools
16
+ puts Dir::ADMINTOOLS
18
17
 
19
- Dir.mkdir('C:\from')
20
- Dir.create_junction('C:\to', 'C:\from')
18
+ Dir.mkdir('C:\from')
19
+ Dir.create_junction('C:\to', 'C:\from')
21
20
 
22
21
  = Constants
23
- Not all of these are guaranteed to be defined on your system. Also note
24
- that the directories are merely defined. It doesn't necessarily mean they
25
- actually exist.
22
+ Not all of these are guaranteed to be defined on your system. Also note
23
+ that the directories are merely defined. It doesn't necessarily mean they
24
+ actually exist.
26
25
 
27
26
  == The following constants should be defined:
28
27
  Dir::ADMINTOOLS
29
- The file system directory that is used to store administrative tools for an
30
- individual user. The Microsoft Management Console (MMC) will save
31
- customized consoles to this directory, and it will roam with the user.
32
-
28
+ The file system directory that is used to store administrative tools for an
29
+ individual user. The Microsoft Management Console (MMC) will save
30
+ customized consoles to this directory, and it will roam with the user.
31
+
33
32
  Dir::COMMON_ADMINTOOLS
34
- The file system directory containing administrative tools for all users
35
- of the computer.
33
+ The file system directory containing administrative tools for all users
34
+ of the computer.
36
35
 
37
36
  Dir::APPDATA
38
- The file system directory that serves as a common repository for
39
- application-specific data. A typical path is
40
- C:\Documents and Settings\<user>\Application Data.
37
+ The file system directory that serves as a common repository for
38
+ application-specific data. A typical path is
39
+ C:\Documents and Settings\<user>\Application Data.
41
40
 
42
- This CSIDL is supported by the redistributable shfolder.dll for
43
- systems that do not have the Microsoft Internet Explorer 4.0
44
- integrated Shell installed.
41
+ This CSIDL is supported by the redistributable shfolder.dll for
42
+ systems that do not have the Microsoft Internet Explorer 4.0
43
+ integrated Shell installed.
45
44
 
46
45
  Dir::COMMON_APPDATA
47
- The file system directory containing application data for all users. A
48
- typical path is C:\Documents and Settings\All Users\Application Data.
46
+ The file system directory containing application data for all users. A
47
+ typical path is C:\Documents and Settings\All Users\Application Data.
49
48
 
50
49
  Dir::COMMON_DOCUMENTS
51
- The file system directory that contains documents that are common to all
52
- users. A typical paths is C:\Documents and Settings\All Users\Documents.
50
+ The file system directory that contains documents that are common to all
51
+ users. A typical paths is C:\Documents and Settings\All Users\Documents.
53
52
 
54
53
  Dir::COOKIES
55
- The file system directory that serves as a common repository for Internet
56
- cookies. A typical path is C:\Documents and Settings\<user>\Cookies.
54
+ The file system directory that serves as a common repository for Internet
55
+ cookies. A typical path is C:\Documents and Settings\<user>\Cookies.
57
56
 
58
57
  Dir::HISTORY
59
- The file system directory that serves as a common repository for Internet
60
- history items.
58
+ The file system directory that serves as a common repository for Internet
59
+ history items.
61
60
 
62
61
  Dir::INTERNET_CACHE
63
- The file system directory that serves as a common repository for temporary
64
- Internet files. A typical path is
65
- C:\Documents and Settings\<user>\Local Settings\Temporary Internet Files.
62
+ The file system directory that serves as a common repository for temporary
63
+ Internet files. A typical path is
64
+ C:\Documents and Settings\<user>\Local Settings\Temporary Internet Files.
66
65
 
67
66
  Dir::LOCAL_APPDATA
68
- The file system directory that serves as a data repository for local
69
- (nonroaming) applications. A typical path is
70
- C:\Documents and Settings\<user>\Local Settings\Application Data.
67
+ The file system directory that serves as a data repository for local
68
+ (nonroaming) applications. A typical path is
69
+ C:\Documents and Settings\<user>\Local Settings\Application Data.
71
70
 
72
71
  Dir::MYPICTURES
73
- The file system directory that serves as a common repository for image
74
- files. A typical path is
75
- C:\Documents and Settings\<user>\My Documents\My Pictures.
72
+ The file system directory that serves as a common repository for image
73
+ files. A typical path is
74
+ C:\Documents and Settings\<user>\My Documents\My Pictures.
76
75
 
77
76
  Dir::PERSONAL
78
- The virtual folder representing the My Documents desktop item. This is
79
- equivalent to Dir::MYDOCUMENTS.
77
+ The virtual folder representing the My Documents desktop item. This is
78
+ equivalent to Dir::MYDOCUMENTS.
80
79
 
81
80
  Dir::PROGRAM_FILES
82
- The Program Files folder. A typical path is C:\Program Files.
81
+ The Program Files folder. A typical path is C:\Program Files.
83
82
 
84
83
  Dir::PROGRAM_FILES_COMMON
85
- A folder for components that are shared across applications. A typical path
86
- is C:\Program Files\Common.
84
+ A folder for components that are shared across applications. A typical path
85
+ is C:\Program Files\Common.
87
86
 
88
87
  Dir::SYSTEM
89
- The Windows System folder. A typical path is C:\Windows\System32.
88
+ The Windows System folder. A typical path is C:\Windows\System32.
90
89
 
91
90
  Dir::WINDOWS
92
- The Windows directory or SYSROOT. This corresponds to the %windir% or
93
- %SYSTEMROOT% environment variables. A typical path is C:\Windows.
91
+ The Windows directory or SYSROOT. This corresponds to the %windir% or
92
+ %SYSTEMROOT% environment variables. A typical path is C:\Windows.
94
93
 
95
94
  == The following constants may or may not be defined:
96
95
  Dir::ALTSTARTUP
97
- The file system directory that corresponds to the user's nonlocalized
98
- Startup program group.
96
+ The file system directory that corresponds to the user's nonlocalized
97
+ Startup program group.
99
98
 
100
99
  Dir::BITBUCKET
101
- The virtual folder containing the objects in the user's Recycle Bin.
100
+ The virtual folder containing the objects in the user's Recycle Bin.
102
101
 
103
102
  Dir::CDBURN_AREA
104
- The file system directory acting as a staging area for files waiting to
105
- be written to CD.
103
+ The file system directory acting as a staging area for files waiting to
104
+ be written to CD.
106
105
 
107
106
  Dir::COMMON_ALTSTARTUP
108
- The file system directory that corresponds to the nonlocalized Startup
109
- program group for all users.
107
+ The file system directory that corresponds to the nonlocalized Startup
108
+ program group for all users.
110
109
 
111
110
  Dir::COMMON_DESKTOPDIRECTORY
112
- The file system directory that contains files and folders that appear on
113
- the desktop for all users. A typical path is
114
- C:\Documents and Settings\All Users\Desktop.
111
+ The file system directory that contains files and folders that appear on
112
+ the desktop for all users. A typical path is
113
+ C:\Documents and Settings\All Users\Desktop.
115
114
 
116
115
  Dir::COMMON_FAVORITES
117
- The file system directory that serves as a common repository for favorite
118
- items common to all users.
116
+ The file system directory that serves as a common repository for favorite
117
+ items common to all users.
119
118
 
120
119
  Dir::COMMON_MUSIC
121
- The file system directory that serves as a repository for music files
122
- common to all users.
120
+ The file system directory that serves as a repository for music files
121
+ common to all users.
123
122
 
124
123
  Dir::COMMON_PICTURES
125
- The file system directory that serves as a repository for image files
126
- common to all users.
124
+ The file system directory that serves as a repository for image files
125
+ common to all users.
127
126
 
128
127
  Dir::COMMON_PROGRAMS
129
- The file system directory that contains the directories for the common
130
- program groups that appear on the Start menu for all users.
128
+ The file system directory that contains the directories for the common
129
+ program groups that appear on the Start menu for all users.
131
130
 
132
131
  Dir::COMMON_STARTMENU
133
- The file system directory that contains the programs and folders that
134
- appear on the Start menu for all users.
132
+ The file system directory that contains the programs and folders that
133
+ appear on the Start menu for all users.
135
134
 
136
135
  Dir::COMMON_STARTUP
137
- The file system directory that contains the programs that appear in the
138
- Startup folder for all users.
136
+ The file system directory that contains the programs that appear in the
137
+ Startup folder for all users.
139
138
 
140
139
  Dir::COMMON_TEMPLATES
141
- The file system directory that contains the templates that are available
142
- to all users.
140
+ The file system directory that contains the templates that are available
141
+ to all users.
143
142
 
144
143
  Dir::COMMON_VIDEO
145
- The file system directory that serves as a repository for video files
146
- common to all users.
144
+ The file system directory that serves as a repository for video files
145
+ common to all users.
147
146
 
148
147
  Dir::CONTROLS
149
- The virtual folder containing icons for the Control Panel applications.
148
+ The virtual folder containing icons for the Control Panel applications.
150
149
 
151
150
  Dir::DESKTOP
152
- The virtual folder representing the Windows desktop, the root of the
153
- namespace.
151
+ The virtual folder representing the Windows desktop, the root of the
152
+ namespace.
154
153
 
155
154
  Dir::DESKTOPDIRECTORY
156
- The file system directory used to physically store file objects on the
157
- desktop (not to be confused with the desktop folder itself).
155
+ The file system directory used to physically store file objects on the
156
+ desktop (not to be confused with the desktop folder itself).
158
157
 
159
158
  Dir::DRIVES
160
- The virtual folder representing My Computer, containing everything on
161
- the local computer: storage devices, printers, and Control Panel. The
162
- folder may also contain mapped network drives.
159
+ The virtual folder representing My Computer, containing everything on
160
+ the local computer: storage devices, printers, and Control Panel. The
161
+ folder may also contain mapped network drives.
163
162
 
164
163
  Dir::FAVORITES
165
- The file system directory that serves as a common repository for the
166
- user's favorite items.
164
+ The file system directory that serves as a common repository for the
165
+ user's favorite items.
167
166
 
168
167
  Dir::FONTS
169
- A virtual folder containing fonts.
168
+ A virtual folder containing fonts.
170
169
 
171
170
  Dir::INTERNET
172
- A virtual folder representing the Internet.
171
+ A virtual folder representing the Internet.
173
172
 
174
173
  Dir::MYDOCUMENTS
175
- The virtual folder representing the My Documents desktop item. See also
176
- Dir::PERSONAL.
174
+ The virtual folder representing the My Documents desktop item. See also
175
+ Dir::PERSONAL.
177
176
 
178
177
  Dir::MYMUSIC
179
- The file system directory that serves as a common repository for music
180
- files.
178
+ The file system directory that serves as a common repository for music files.
181
179
 
182
180
  Dir::MYVIDEO
183
- The file system directory that serves as a common repository for video
184
- files.
181
+ The file system directory that serves as a common repository for video files.
185
182
 
186
183
  Dir::NETHOOD
187
- A file system directory containing the link objects that may exist in the
188
- My Network Places virtual folder. It is not the same as Dir::NETWORK, which
189
- represents the network namespace root.
184
+ A file system directory containing the link objects that may exist in the
185
+ My Network Places virtual folder. It is not the same as Dir::NETWORK, which
186
+ represents the network namespace root.
190
187
 
191
188
  Dir::NETWORK
192
- A virtual folder representing Network Neighborhood, the root of the network
193
- namespace hierarchy.
189
+ A virtual folder representing Network Neighborhood, the root of the network
190
+ namespace hierarchy.
194
191
 
195
192
  Dir::PRINTERS
196
- The virtual folder containing installed printers.
193
+ The virtual folder containing installed printers.
197
194
 
198
195
  Dir::PRINTHOOD
199
- The file system directory that contains the link objects that can exist in
200
- the "Printers" virtual folder.
196
+ The file system directory that contains the link objects that can exist in
197
+ the "Printers" virtual folder.
201
198
 
202
199
  Dir::PROFILE
203
- The user's profile folder.
200
+ The user's profile folder.
204
201
 
205
202
  Dir::PROFILES
206
- The file system directory containing user profile folders.
203
+ The file system directory containing user profile folders.
207
204
 
208
205
  Dir::PROGRAMS
209
- The file system directory that contains the user's program groups (which
210
- are themselves file system directories).
206
+ The file system directory that contains the user's program groups (which
207
+ are themselves file system directories).
211
208
 
212
209
  Dir::RECENT
213
- The file system directory that contains shortcuts to the user's most
214
- recently used documents.
210
+ The file system directory that contains shortcuts to the user's most
211
+ recently used documents.
215
212
 
216
213
  Dir::SENDTO
217
- The file system directory that contains Send To menu items.
214
+ The file system directory that contains Send To menu items.
218
215
 
219
216
  Dir::STARTMENU
220
- The file system directory containing Start menu items.
217
+ The file system directory containing Start menu items.
221
218
 
222
219
  Dir::STARTUP
223
- The file system directory that corresponds to the user's Startup program
224
- group.
220
+ The file system directory that corresponds to the user's Startup program
221
+ group.
225
222
 
226
223
  Dir::TEMPLATES
227
- The file system directory that serves as a common repository for document
228
- templates.
224
+ The file system directory that serves as a common repository for document
225
+ templates.
229
226
 
230
227
  == Developer's Notes
231
- The SHGetFolderPath() documentation on MSDN is somewhat vague about which
232
- CSIDL constants are guaranteed to be defined. However, there are 15 which
233
- *should* be defined (see docs above). The rest I cannot vouch for.
228
+ The SHGetFolderPath() documentation on MSDN is somewhat vague about which
229
+ CSIDL constants are guaranteed to be defined. However, there are 15 which
230
+ *should* be defined (see docs above). The rest I cannot vouch for.
234
231
 
235
- Some of these folders are virtual, and the value will be the display name
236
- only instead of an actual path.
232
+ Some of these folders are virtual, and the value will be the display name
233
+ only instead of an actual path.
237
234
 
238
235
  == Known Bugs
239
- The Unicode support is not quite there for Dir.create_junction. It creates
240
- the directory and junction fine, but the +to+ name appears to get garbled
241
- with regards to the character set.
236
+ The Unicode support is not quite there for Dir.create_junction. It creates
237
+ the directory and junction fine, but the +to+ name appears to get garbled
238
+ with regards to the character set.
242
239
 
243
- Please log any other bug reports on the RubyForge project page at
244
- http://www.rubyforge.net/projects/win32utils.
240
+ Please log any other bug reports on the RubyForge project page at
241
+ http://www.rubyforge.net/projects/win32utils.
245
242
 
246
243
  == Future Plans
247
- Fix the Unicode issue with Dir.create_junction.
248
- Other suggestions welcome.
244
+ Fix the Unicode issue with Dir.create_junction.
245
+ Other suggestions welcome.
249
246
 
250
247
  == Acknowledgements
251
- Shashank Date and Zach Dennis for the suggestion and supporting comments
252
- on the mailing list.
248
+ Shashank Date and Zach Dennis for the suggestion and supporting comments
249
+ on the mailing list.
253
250
 
254
- Timothy Byrd and Autrijus Tang for help (directly or indirectly) with the
255
- junction methods. Timothy provided a pure Ruby version of the junction
256
- code that I later borrowed from.
251
+ Timothy Byrd and Autrijus Tang for help (directly or indirectly) with the
252
+ junction methods. Timothy provided a pure Ruby version of the junction
253
+ code that I later borrowed from.
257
254
 
258
- Most of the documentation was copied from the MSDN web site.
255
+ Most of the documentation was copied from the MSDN web site.
259
256
 
260
257
  == License
261
- Artistic 2.0
258
+ Artistic 2.0
262
259
 
263
260
  == Copyright
264
- (C) 2003-2009 Daniel J. Berger, All Rights Reserved
261
+ (C) 2003-2010 Daniel J. Berger, All Rights Reserved
265
262
 
266
263
  == Warranty
267
- This package is provided "as is" and without any express or
268
- implied warranties, including, without limitation, the implied
269
- warranties of merchantability and fitness for a particular purpose.
264
+ This package is provided "as is" and without any express or
265
+ implied warranties, including, without limitation, the implied
266
+ warranties of merchantability and fitness for a particular purpose.
270
267
 
271
268
  == Authors
272
- Daniel J. Berger
273
- Park Heesob
269
+ Daniel J. Berger
270
+ Park Heesob
data/Rakefile CHANGED
@@ -3,23 +3,32 @@ require 'rake/testtask'
3
3
 
4
4
  desc "Install the win32-dir package (non-gem)"
5
5
  task :install do
6
- dest = File.join(Config::CONFIG['sitelibdir'], 'win32')
7
- Dir.mkdir(dest) unless File.exists? dest
8
- cp 'lib/win32/dir.rb', dest, :verbose => true
6
+ dest = File.join(Config::CONFIG['sitelibdir'], 'win32')
7
+ Dir.mkdir(dest) unless File.exists? dest
8
+ cp 'lib/win32/dir.rb', dest, :verbose => true
9
9
  end
10
10
 
11
- desc "Install the win32-dir package as a gem"
12
- task :install_gem do
13
- ruby 'win32-dir.gemspec'
14
- file = Dir["*.gem"].first
15
- sh "gem install #{file}"
11
+ namespace 'gem' do
12
+ desc "Build the gem"
13
+ task :build do
14
+ Dir["*.gem"].each{ |f| File.delete(f) }
15
+ spec = eval(IO.read('win32-dir.gemspec'))
16
+ Gem::Builder.new(spec).build
17
+ end
18
+
19
+ desc "Install the win32-dir package as a gem"
20
+ task :install => [:build] do
21
+ file = Dir["*.gem"].first
22
+ sh "gem install #{file}"
23
+ end
16
24
  end
17
25
 
18
26
  desc "Run the example program"
19
27
  task :example do
20
- sh "ruby -Ilib examples/dir_example.rb"
28
+ sh "ruby -Ilib examples/dir_example.rb"
29
+ end
21
30
 
22
31
  Rake::TestTask.new do |t|
23
- t.warning = true
24
- t.verbose = true
32
+ t.warning = true
33
+ t.verbose = true
25
34
  end