/
README
94 lines (76 loc) · 3.53 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
== Description
A redefinition of the File::Stat class for MS Windows.
== Prerequisites
* ffi
* Ruby 1.9 or later
== Installation
gem install win32-file-stat
== Synopsis
# require 'win32/file/stat' # Unwise. See below.
require 'win32/file' # Preferred. See below.
stat = File::Stat.new('file.txt')
p stat.size
p stat.readonly?
p stat.hidden?
p stat.uid
p stat.streams
== Differences between Ruby's File::Stat and this version:
* The File::Stat#blksize method returns a meaningful value.
* The File::Stat#blockdev method works more accurately.
* The File::Stat#blocks method returns a meaningful value.
* The File::Stat#executable? method works properly.
* The File::Stat#executable_real? is an alias for File::Stat#executable?
* The File::Stat#file? method works properly.
* The File::Stat#ftype method works more accurately.
* The File::Stat#pipe method works properly.
* The File::Stat#socket method works more accurately.
* The File::Stat#ino method now returns a file identifier.
* The File::Stat#socket? method works properly.
* The File::Stat#symlink? method works properly.
* The File::Stat#uid method returns a meaningful value.
* The File::Stat#gid method returns a meaningful value.
* The File::Stat#owned? method now works properly.
* The File::Stat#grpowned? method now works properly.
* The File::Stat#rdev method returns the volume serial number.
* The inspect and pretty print output has been customized.
* The File::Stat#streams was added. Returns an array of alt streams.
== Changes between this version and the previous versions.
The File::Stat#dev method has reverted to returning a drive number by
default. However, you can pass an optional boolean argument to make it
return the drive letter instead.
== Known issues
You should not require 'win32/file/stat' directly. Instead, require the
win32-file library which will, in turn, require win32-file-stat. This is
the preferred approach because some modules (i.e. 'find') use the pass-through
methods of the File class, such as File.lstat. Many of the pass through
methods have been redefined in the win32-file library to work in conjunction
with the custom File::Stat objects created by this library.
Failure to follow these instructions could lead to cases where the core Ruby
File class attempts to use the custom File::Stat object defined in this class,
and that will likely cause problems.
If run in verbose mode you will see a warning about initialize being
redefined. I can do nothing about that since my old trick of aliasing and
undefining initialize now causes a warning as well!
== Known bugs
None that I'm aware of beyond the "Known Issues" listed above. Please report
any bugs you find on the project page at:
http://www.github.com/djberg96/win32-file-stat
== Miscellaneous
I had to require 'pp' explicitly in order to deal with the fact that pp.rb
has a builtin pretty_print method for File::Stat. If I didn't do this
you would end up using the pretty_print in pp.rb, which would break.
== Contributions
Although this library is free, please consider having your company
setup a gittip if used by your company professionally.
http://www.gittip.com/djberg96/
== Copyright
(C) 2003-2016, Daniel J. Berger, All Rights Reserved.
== License
Artistic 2.0
= Warranty
This library is provided "as is" and without any express or
implied warranties, including, without limitation, the implied
warranties of merchantability and fitness for a particular purpose.
= Authors
Daniel J. Berger
Park Heesob