win32-file 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +126 -0
- data/MANIFEST +16 -0
- data/README +98 -0
- data/install.rb +11 -0
- data/lib/win32/file.rb +1037 -0
- data/test/sometestfile.txt +1 -0
- data/test/tc_file_attributes.rb +253 -0
- data/test/tc_file_constants.rb +53 -0
- data/test/tc_file_encryption.rb +36 -0
- data/test/tc_file_path.rb +171 -0
- data/test/tc_file_security.rb +56 -0
- data/test/tc_file_stat.rb +96 -0
- data/test/ts_all.rb +11 -0
- data/win32-file.gemspec +24 -0
- metadata +70 -0
data/CHANGES
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
== 0.5.3 - 2-Nov-2006
|
2
|
+
* Added the File.lstat method. It's abscence caused problems for cross
|
3
|
+
platform packages (such as the 'find' module) which were expecting a result
|
4
|
+
for File.lstat. Thanks go to "Oliver" (python152) from the mailing list
|
5
|
+
for the spot.
|
6
|
+
|
7
|
+
== 0.5.2 - 12-May-2006
|
8
|
+
* Added explicit File.stat and File#stat methods to ensure that the File::Stat
|
9
|
+
object returned is the one defined in the win32-file-stat package.
|
10
|
+
|
11
|
+
== 0.5.1 - 27-Apr-2006
|
12
|
+
* Added the File.content_indexed? alias for File.indexed?
|
13
|
+
* Added the corresponding File::CONTENT_INDEXED constant alias.
|
14
|
+
* Fixed an issue with the Windows::Error module not being extended the way
|
15
|
+
it should have been.
|
16
|
+
* Updated the ts_all.rb file to actually include *all* the tests.
|
17
|
+
|
18
|
+
== 0.5.0 - 22-Apr-2006
|
19
|
+
* Replaced C version with pure Ruby version.
|
20
|
+
* Added a gem.
|
21
|
+
* Requires the win32-file-stat package. Some methods are just a facade for
|
22
|
+
File::Stat methods.
|
23
|
+
* Removed the native IO methods and related attributes - nread, nwrite, flags,
|
24
|
+
creation_mode, share_mode, access_mode. These will be moved into their own
|
25
|
+
package (win32-io) eventually.
|
26
|
+
* The File.get_permissions method now takes an optional hostname as the second
|
27
|
+
argument. If it isn't provided, it defaults to localhost.
|
28
|
+
* The File.set_attr method was renamed to File.set_attributes (though an alias
|
29
|
+
has been provided for backwards compatibility).
|
30
|
+
* The File.unset_attr method was renamed to File.remove_attributes. Again, an
|
31
|
+
alias was created for backwards compatibility.
|
32
|
+
* The File.content_indexed? method is now just File.indexed? Likewise, the
|
33
|
+
File::CONTENT_INDEXED constant is now just File::INDEXED.
|
34
|
+
|
35
|
+
== 0.4.6 - 20-Nov-2005
|
36
|
+
* Fixed potential segfaults caused by passing invalid types. This affects
|
37
|
+
most methods.
|
38
|
+
* Added more tests to look for explicit TypeError's.
|
39
|
+
|
40
|
+
== 0.4.5 - 17-Sep-2005
|
41
|
+
* Fixed bug in File.basename and File.dirname where receiver was being
|
42
|
+
modified.
|
43
|
+
* Overrode the File.split method to handle UNC paths properly.
|
44
|
+
* More tests.
|
45
|
+
|
46
|
+
== 0.4.4 - 20-Aug-2005
|
47
|
+
* Fixed some bugs in the File.basename method.
|
48
|
+
* Added more tests for the File.basename method.
|
49
|
+
|
50
|
+
== 0.4.3 - 25-May-2005
|
51
|
+
* Added custom versions of File.basename and File.dirname so that they work
|
52
|
+
with UNC paths correctly. This requires linking against libshlwapi, which
|
53
|
+
was added in the extconf.rb file.
|
54
|
+
* Better Unicode support (I think).
|
55
|
+
* Added some safe string handling.
|
56
|
+
* Tests added for File.basename and File.dirname.
|
57
|
+
* Removed the file.rd file. You can run rdoc over the file.txt file to
|
58
|
+
generate html documentation if you wish.
|
59
|
+
|
60
|
+
== 0.4.2 - 1-Feb-2005
|
61
|
+
* Added a macro check for EncryptFile(), which turns out to only be supported
|
62
|
+
on Windows 2000 or later. Thanks go to Takaaki Tateishi for the spot.
|
63
|
+
|
64
|
+
== 0.4.1 - 30-Nov-2004
|
65
|
+
* Added working implementations for File.blockdev? and File.chardev?
|
66
|
+
* Corresponding test suite and doc additions.
|
67
|
+
* Corrected the release date for 0.4.0.
|
68
|
+
|
69
|
+
== 0.4.0 - 26-Nov-2004
|
70
|
+
* Added the File.nopen class method, and File#nread and File#nwrite instance
|
71
|
+
methods. These are wrappers for Window's native methods. See documentation
|
72
|
+
for more details. Also see some examples in the 'examples' directory.
|
73
|
+
* Added my own implementation of File.size, because the current version is not
|
74
|
+
64 bit aware (i.e. does not return correct values for sizes over 2 GB). I
|
75
|
+
will remove this once Ruby has been updated.
|
76
|
+
* Modified File#path to use GetFullPathName() internally if Ruby's own
|
77
|
+
File#path method fails. This was mostly done for internal usage, but it
|
78
|
+
has the effect of making File#path a little more robust on Windows I think.
|
79
|
+
|
80
|
+
== 0.3.0 - 10-Nov-2004
|
81
|
+
* Added the archive=, hidden=, normal=, compressed=, content_indexed=,
|
82
|
+
offline=, readonly=, sparse=, system=, and temporary= instance methods.
|
83
|
+
* Changed set_permission to set_permissions, and get_permission to
|
84
|
+
get_permissions, respectively.
|
85
|
+
* Moved the examples directory to the toplevel directory.
|
86
|
+
* Added and/or modified some files to be rdoc friendly.
|
87
|
+
* Documentation and test suite updates.
|
88
|
+
|
89
|
+
== 0.2.2 - 17-Aug-2004
|
90
|
+
* Added the encrypt() and decrypt() class methods. These are wrappers
|
91
|
+
for the EncryptFile() and DecryptFile() Win32 functions.
|
92
|
+
* Corresponding test suite and documentation additions.
|
93
|
+
* Added a crypt and decrypt test example, crypt_test.rb, under doc/examples.
|
94
|
+
|
95
|
+
== 0.2.1 - 10-Aug-2004
|
96
|
+
* Replaced all occurrences of the deprecated STR2CSTR() function with
|
97
|
+
StringValuePtr(). That means that, as of this release, this package
|
98
|
+
requires Ruby 1.8.0 or later.
|
99
|
+
* Added the long_path method (may not be supported on NT).
|
100
|
+
* Documentation and test suite additions
|
101
|
+
* Some code cleanup and reorganization.
|
102
|
+
* Moved sample scripts to doc/examples.
|
103
|
+
* Removed the file.html file from the doc directory. You can generate the
|
104
|
+
html documentation with rd2 if you like.
|
105
|
+
|
106
|
+
== 0.2.0 - 8-May-2004
|
107
|
+
* Removed the toplevel Win32 module/namespace (except for the require line).
|
108
|
+
I felt that having to put "Win32::" in front of all the methods was too
|
109
|
+
painful.
|
110
|
+
* Added the CACLS attribute getter and setter (Park).
|
111
|
+
* Updated docs to reflect changes, added warranty information.
|
112
|
+
* Moved the pure ruby version to its own directory. In lieu of the installer
|
113
|
+
now available for our packages, this version is no longer guaranteed to be
|
114
|
+
maintained, but I'll leave it in the package for now.
|
115
|
+
|
116
|
+
== 0.1.1 - 3-Nov-2003
|
117
|
+
* Added the content_indexed? method
|
118
|
+
* Added the set_attr and unset_attr methods
|
119
|
+
* Added constants that apply to set_attr and unset_attr
|
120
|
+
* Replaced GetFileAttributesEx() with the simpler GetFileAttributes().
|
121
|
+
The former provides no additional information that isn't already covered by File::Stat.
|
122
|
+
* Test suite additions
|
123
|
+
* Documentation additions
|
124
|
+
|
125
|
+
== 0.1.0 - 29-Oct-2003
|
126
|
+
* Initial release
|
data/MANIFEST
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
CHANGES
|
2
|
+
MANIFEST
|
3
|
+
README
|
4
|
+
install.rb
|
5
|
+
win32-file.gemspec
|
6
|
+
|
7
|
+
lib/win32/file.rb
|
8
|
+
|
9
|
+
test/sometestfile.txt
|
10
|
+
test/tc_file_attributes.rb
|
11
|
+
test/tc_file_constants.rb
|
12
|
+
test/tc_file_encryption.rb
|
13
|
+
test/tc_file_path.rb
|
14
|
+
test/tc_file_security.rb
|
15
|
+
test/tc_file_stat.rb
|
16
|
+
test/ts_all.rb
|
data/README
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
= Description
|
2
|
+
Extra or redefined methods for the File class on MS Windows.
|
3
|
+
|
4
|
+
= Prerequisites
|
5
|
+
Ruby 1.8.0 or later
|
6
|
+
windows-pr 0.3.0 or later
|
7
|
+
win32-file-stat 1.2.0 or later
|
8
|
+
|
9
|
+
= Installation
|
10
|
+
== Manual install
|
11
|
+
ruby test/ts_all.rb # optional
|
12
|
+
ruby install.rb
|
13
|
+
== Gem Install
|
14
|
+
ruby win32-file.gemspec
|
15
|
+
gem install win32-file-X.Y.Z-mswin32.gem
|
16
|
+
|
17
|
+
= Synopsis
|
18
|
+
require 'win32/file'
|
19
|
+
|
20
|
+
p File.hidden?(somefile)
|
21
|
+
p File.attributes(somefile)
|
22
|
+
|
23
|
+
File.open(somefile){ |fh|
|
24
|
+
fh.hidden = true
|
25
|
+
}
|
26
|
+
|
27
|
+
= Class methods added - see documentation for details
|
28
|
+
* File.attributes
|
29
|
+
* File.archive?
|
30
|
+
* File.compressed?
|
31
|
+
* File.decrypt
|
32
|
+
* File.encrypt
|
33
|
+
* File.encrypted?
|
34
|
+
* File.get_permissions
|
35
|
+
* File.hidden?
|
36
|
+
* File.indexed?
|
37
|
+
* File.longpath
|
38
|
+
* File.normal?
|
39
|
+
* File.offline?
|
40
|
+
* File.readonly?
|
41
|
+
* File.remove_attributes
|
42
|
+
* File.reparse_point?
|
43
|
+
* File.securities
|
44
|
+
* File.set_attributes
|
45
|
+
* File.set_permissions
|
46
|
+
* File.shortpath
|
47
|
+
* File.sparse?
|
48
|
+
* File.system?
|
49
|
+
* File.temporary?
|
50
|
+
|
51
|
+
= Instance methods added - see documentation for details
|
52
|
+
* File#archive=
|
53
|
+
* File#compressed=
|
54
|
+
* File#hidden=
|
55
|
+
* File#indexed=
|
56
|
+
* File#normal=
|
57
|
+
* File#offline=
|
58
|
+
* File#readonly=
|
59
|
+
* File#sparse=
|
60
|
+
* File#system=
|
61
|
+
* File#temporary=
|
62
|
+
|
63
|
+
= Class methods redefined
|
64
|
+
* File.basename # UNC path issues
|
65
|
+
* File.blksize # Wasn't implemented
|
66
|
+
* File.blockdev? # Wasn't implemented
|
67
|
+
* File.chardev? # Wasn't implemented
|
68
|
+
* File.dirname # UNC path issues
|
69
|
+
* File.size # 2GB limitation
|
70
|
+
* File.split # UNC path issues
|
71
|
+
|
72
|
+
= Notes about the test suite
|
73
|
+
For all the unit tests to pass, the 'sometestfile.txt' file must have the
|
74
|
+
'archive' and 'readonly' attributes set. Although I have them set on the
|
75
|
+
file when I create the zip archive, it seems that file attributes aren't
|
76
|
+
guaranteed to survive the process.
|
77
|
+
|
78
|
+
So, please change the file attributes manually if needed before running the
|
79
|
+
test suite. You can do this by right-clicking on the file in Explorer and
|
80
|
+
selecting 'properties'. The readonly attribute check-box is at the bottom
|
81
|
+
left corner. To get to the archive attribute click on the 'Advanced' tab.
|
82
|
+
You should see a checkbox at the top.
|
83
|
+
|
84
|
+
= Known issues or bugs
|
85
|
+
None that I'm aware of. Please report any bugs you find on the project page
|
86
|
+
at http://www.rubyforge.org/projects/win32utils.
|
87
|
+
|
88
|
+
= License
|
89
|
+
Ruby's
|
90
|
+
|
91
|
+
= Warranty
|
92
|
+
This package is provided "as is" and without any express or
|
93
|
+
implied warranties, including, without limitation, the implied
|
94
|
+
warranties of merchantability and fitness for a particular purpose.
|
95
|
+
|
96
|
+
= Authors
|
97
|
+
Daniel J. Berger
|
98
|
+
Park Heesob
|
data/install.rb
ADDED
@@ -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\file.rb'
|
9
|
+
|
10
|
+
Dir.mkdir(installdir) unless File.exists?(installdir)
|
11
|
+
File.copy(file, installdir, true)
|