win32-file-stat 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +6 -2
- data/Rakefile +1 -1
- data/lib/win32/file/stat.rb +8 -2
- data/test/test_file_stat.rb +14 -5
- data/win32-file-stat.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee8c0c3a76c7fcc22794899ff2cb0e0f455ba6e0
|
4
|
+
data.tar.gz: 73fbaca95c61912ef6e62f7baa2bf26c3a6f9f66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cd9985c5a62e7d71e99f586dfe2f18dc1f49fedc4c808db474fa2f5f0b790870612d1f114450de484e93bdeda2b34e1c1339efe2773cc4401a7f3ef6fe56680
|
7
|
+
data.tar.gz: 0db9479f32582058da50eaff0afff77226f9fa51e7a520aeb2dd0b9e5f2ee63c260f9d3ae0cf1f96cb8bf9cf421b57d5857c44ffbcf0677ce3d8b4dc95e7990a
|
data/CHANGES
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
+
== 1.4.3 - 8-May-2014
|
2
|
+
* The #writable? method now ignores the readonly attribute if it's a directory.
|
3
|
+
* Replaced File.exists? with File.exist? to avoid warnings in Ruby 2.1.x.
|
4
|
+
|
1
5
|
== 1.4.2 - 28-Apr-2014
|
2
6
|
* Allow the File::Stat.new method to accept objects that respond to to_str
|
3
7
|
or to_path to mimic MRI.
|
4
8
|
|
5
9
|
== 1.4.1 - 12-Feb-2014
|
6
|
-
* The #writable and #writable_real methods now always return false if the
|
7
|
-
has been marked readonly.
|
10
|
+
* The #writable? and #writable_real? methods now always return false if the
|
11
|
+
file has been marked readonly.
|
8
12
|
* Fixed an rdev test and added a writable test.
|
9
13
|
|
10
14
|
== 1.4.0 - 16-Dec-2013
|
data/Rakefile
CHANGED
data/lib/win32/file/stat.rb
CHANGED
@@ -55,7 +55,7 @@ class File::Stat
|
|
55
55
|
attr_reader :dev_major, :dev_minor, :rdev_major, :rdev_minor
|
56
56
|
|
57
57
|
# The version of the win32-file-stat library
|
58
|
-
WIN32_FILE_STAT_VERSION = '1.4.
|
58
|
+
WIN32_FILE_STAT_VERSION = '1.4.3'
|
59
59
|
|
60
60
|
# Creates and returns a File::Stat object, which encapsulate common status
|
61
61
|
# information for File objects on MS Windows sytems. The information is
|
@@ -173,7 +173,13 @@ class File::Stat
|
|
173
173
|
@readable = access_check(path, GENERIC_READ)
|
174
174
|
@readable_real = @readable
|
175
175
|
|
176
|
-
|
176
|
+
# The MSDN docs say that the readonly attribute is honored for directories
|
177
|
+
if @directory
|
178
|
+
@writable = access_check(path, GENERIC_WRITE)
|
179
|
+
else
|
180
|
+
@writable = access_check(path, GENERIC_WRITE) && !@readonly
|
181
|
+
end
|
182
|
+
|
177
183
|
@writable_real = @writable
|
178
184
|
|
179
185
|
@world_readable = access_check_world(path, FILE_READ_DATA)
|
data/test/test_file_stat.rb
CHANGED
@@ -54,7 +54,7 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
|
|
54
54
|
end
|
55
55
|
|
56
56
|
test "version is set to expected value" do
|
57
|
-
assert_equal('1.4.
|
57
|
+
assert_equal('1.4.3', File::Stat::WIN32_FILE_STAT_VERSION)
|
58
58
|
end
|
59
59
|
|
60
60
|
test "constructor does not modify argument" do
|
@@ -460,7 +460,7 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
|
|
460
460
|
|
461
461
|
# Not sure how to test properly in a generic way, but works on my local network
|
462
462
|
test "rdev works on unc path" do
|
463
|
-
omit_unless(Etc.getlogin == "djberge" && File.
|
463
|
+
omit_unless(Etc.getlogin == "djberge" && File.exist?("//scipio/users"))
|
464
464
|
assert_true(File::Stat.new("//scipio/users").rdev > 1000)
|
465
465
|
end
|
466
466
|
|
@@ -604,6 +604,15 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
|
|
604
604
|
assert_false(File::Stat.new(@@sys_file).writable?)
|
605
605
|
end
|
606
606
|
|
607
|
+
test "writable? returns expected result for system directory" do
|
608
|
+
dir = "C:/Program Files"
|
609
|
+
if @@elevated
|
610
|
+
assert_true(File::Stat.new(dir).writable?)
|
611
|
+
else
|
612
|
+
assert_false(File::Stat.new(dir).writable?)
|
613
|
+
end
|
614
|
+
end
|
615
|
+
|
607
616
|
test "a file marked as readonly is not considered writable" do
|
608
617
|
File.chmod(0644, @@txt_file)
|
609
618
|
assert_true(File::Stat.new(@@txt_file).writable?)
|
@@ -638,7 +647,7 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
|
|
638
647
|
|
639
648
|
def teardown
|
640
649
|
SetFileAttributes(@@txt_file, @attr) # Set file back to normal
|
641
|
-
File.delete(@temp) if File.
|
650
|
+
File.delete(@temp) if File.exist?(@temp)
|
642
651
|
@dir = nil
|
643
652
|
@stat = nil
|
644
653
|
@attr = nil
|
@@ -646,8 +655,8 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
|
|
646
655
|
end
|
647
656
|
|
648
657
|
def self.shutdown
|
649
|
-
File.delete(@@txt_file) if File.
|
650
|
-
File.delete(@@exe_file) if File.
|
658
|
+
File.delete(@@txt_file) if File.exist?(@@txt_file)
|
659
|
+
File.delete(@@exe_file) if File.exist?(@@exe_file)
|
651
660
|
|
652
661
|
@@block_dev = nil
|
653
662
|
@@txt_file = nil
|
data/win32-file-stat.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: win32-file-stat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|