win32-xpath 1.0.2 → 1.0.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.
- checksums.yaml +4 -4
- data/CHANGES +11 -8
- data/MANIFEST +9 -9
- data/README +65 -54
- data/Rakefile +60 -60
- data/bench/bench_win32_xpath.rb +79 -79
- data/ext/extconf.rb +13 -4
- data/ext/win32/xpath.c +399 -369
- data/futzing/futz.rb +71 -71
- data/futzing/test.rb +90 -90
- data/test/test_win32_xpath.rb +206 -185
- data/win32-xpath.gemspec +25 -25
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 685daea6a90d6d67f915aeb1595dd45fc636701b
|
4
|
+
data.tar.gz: 7af2b9489ed6e8cd5d97003f95633a9b48b53ee1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63dbc8982a5433a9a9a2c409817f46c91fe9f80165d36d70a096be99a0539bc7b563e480c179db8498fa895e615b96ac4e57b742fb72e591ea56def8d03a7091
|
7
|
+
data.tar.gz: 5b5b8e65792411768a15b7804043b8f3e42f6f8e06c2e885edeb06f34d807c633cd146ba1f95f2ffc16f74f33e68f3e1bb7991c90351997fd2133dd804d7cb40
|
data/CHANGES
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
= 1.0.
|
2
|
-
*
|
3
|
-
|
4
|
-
= 1.0.
|
5
|
-
*
|
6
|
-
|
7
|
-
= 1.0.
|
8
|
-
*
|
1
|
+
= 1.0.3 - 3-Jul-2015
|
2
|
+
* Use PathCchXXX functions where available to improve long path handling.
|
3
|
+
|
4
|
+
= 1.0.2 - 17-Jun-2015
|
5
|
+
* Deal with non-standard swprintf issues so that it works with mingw compiler.
|
6
|
+
|
7
|
+
= 1.0.1 - 2-Apr-2015
|
8
|
+
* Altered internal handling of native C function failures.
|
9
|
+
|
10
|
+
= 1.0.0 - 26-Feb-2015
|
11
|
+
* Initial release
|
data/MANIFEST
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
bench/bench_win32_xpath.rb
|
2
|
-
CHANGES
|
3
|
-
ext/extconf.rb
|
4
|
-
ext/win32/xpath.c
|
5
|
-
futzing/futz.rb
|
6
|
-
Rakefile
|
7
|
-
README
|
8
|
-
test/test_win32_xpath.rb
|
9
|
-
win32-xpath.gemspec
|
1
|
+
bench/bench_win32_xpath.rb
|
2
|
+
CHANGES
|
3
|
+
ext/extconf.rb
|
4
|
+
ext/win32/xpath.c
|
5
|
+
futzing/futz.rb
|
6
|
+
Rakefile
|
7
|
+
README
|
8
|
+
test/test_win32_xpath.rb
|
9
|
+
win32-xpath.gemspec
|
data/README
CHANGED
@@ -1,54 +1,65 @@
|
|
1
|
-
= Description
|
2
|
-
A custom File.expand_path method for Ruby on Windows that's much
|
3
|
-
faster and works better.
|
4
|
-
|
5
|
-
= Installation
|
6
|
-
gem install win32-xpath
|
7
|
-
|
8
|
-
= Synopsis
|
9
|
-
require 'win32/xpath'
|
10
|
-
|
11
|
-
# That's it, you are now using this library when you call File.expand_path
|
12
|
-
|
13
|
-
= Features
|
14
|
-
* A 5x average performance boost over MRI's current method.
|
15
|
-
* Support for ~user expansion.
|
16
|
-
|
17
|
-
= Known Issues
|
18
|
-
* This library does not support drive-current paths for the 2nd argument.
|
19
|
-
* This library does not support alt-stream name autocorrection.
|
20
|
-
|
21
|
-
It is very unlikely you will ever be affected by either of these things.
|
22
|
-
Drive-current paths are a relic of DOS 1.0, but even so this library
|
23
|
-
will handle them in the first argument.
|
24
|
-
|
25
|
-
I don't support alt-stream mangling because I don't believe it's the
|
26
|
-
job of this method to peform autocorrection. Even in MRI it only works
|
27
|
-
for the default $DATA stream, and then only for a certain type of
|
28
|
-
syntax error. I do not know when or why it was added.
|
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
|
-
|
1
|
+
= Description
|
2
|
+
A custom File.expand_path method for Ruby on Windows that's much
|
3
|
+
faster and works better.
|
4
|
+
|
5
|
+
= Installation
|
6
|
+
gem install win32-xpath
|
7
|
+
|
8
|
+
= Synopsis
|
9
|
+
require 'win32/xpath'
|
10
|
+
|
11
|
+
# That's it, you are now using this library when you call File.expand_path
|
12
|
+
|
13
|
+
= Features
|
14
|
+
* A 5x average performance boost over MRI's current method.
|
15
|
+
* Support for ~user expansion.
|
16
|
+
|
17
|
+
= Known Issues
|
18
|
+
* This library does not support drive-current paths for the 2nd argument.
|
19
|
+
* This library does not support alt-stream name autocorrection.
|
20
|
+
|
21
|
+
It is very unlikely you will ever be affected by either of these things.
|
22
|
+
Drive-current paths are a relic of DOS 1.0, but even so this library
|
23
|
+
will handle them in the first argument.
|
24
|
+
|
25
|
+
I don't support alt-stream mangling because I don't believe it's the
|
26
|
+
job of this method to peform autocorrection. Even in MRI it only works
|
27
|
+
for the default $DATA stream, and then only for a certain type of
|
28
|
+
syntax error. I do not know when or why it was added.
|
29
|
+
|
30
|
+
One possible "real" issue is that on Windows 7 or earlier you will be
|
31
|
+
limited to 260 character paths. This is a limitation of the shlwapi.h
|
32
|
+
functions that I use internally.
|
33
|
+
|
34
|
+
If you discover any other issues, please report them on the project
|
35
|
+
page at https://github.com/djberg96/win32-xpath.
|
36
|
+
|
37
|
+
= Mingw and Devkit
|
38
|
+
Make sure you have a recent version of the Devkit installed if you're
|
39
|
+
using the one-click installer. If you see this warning then you need
|
40
|
+
to upgrade your Devkit.
|
41
|
+
|
42
|
+
"implicit declaration of function 'ConvertSidToStringSidW'"
|
43
|
+
|
44
|
+
= Acknowledgements
|
45
|
+
Park Heesob for encoding advice and help.
|
46
|
+
|
47
|
+
== License
|
48
|
+
Artistic 2.0
|
49
|
+
|
50
|
+
== Contributions
|
51
|
+
Although this library is free, please consider having your company
|
52
|
+
setup a gittip if used by your company professionally.
|
53
|
+
|
54
|
+
http://www.gittip.com/djberg96/
|
55
|
+
|
56
|
+
== Copyright
|
57
|
+
(C) 2003-2015 Daniel J. Berger, All Rights Reserved
|
58
|
+
|
59
|
+
== Warranty
|
60
|
+
This package is provided "as is" and without any express or
|
61
|
+
implied warranties, including, without limitation, the implied
|
62
|
+
warranties of merchantability and fitness for a particular purpose.
|
63
|
+
|
64
|
+
= Author
|
65
|
+
Daniel Berger
|
data/Rakefile
CHANGED
@@ -1,60 +1,60 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/clean'
|
3
|
-
require 'rake/testtask'
|
4
|
-
require 'rbconfig'
|
5
|
-
include RbConfig
|
6
|
-
|
7
|
-
CLEAN.include(
|
8
|
-
'**/*.gem', # Gem files
|
9
|
-
'**/*.rbc', # Rubinius
|
10
|
-
'**/*.o', # C object file
|
11
|
-
'**/*.log', # Ruby extension build log
|
12
|
-
'**/Makefile', # C Makefile
|
13
|
-
'**/*.def', # Definition files
|
14
|
-
'**/*.exp',
|
15
|
-
'**/*.lib',
|
16
|
-
'**/*.pdb',
|
17
|
-
'**/*.obj',
|
18
|
-
'**/*.stackdump', # Junk that can happen on Windows
|
19
|
-
"**/*.#{CONFIG['DLEXT']}" # C shared object
|
20
|
-
)
|
21
|
-
|
22
|
-
make = CONFIG['host_os'] =~ /mingw|cygwin/i ? 'make' : 'nmake'
|
23
|
-
|
24
|
-
desc "Build the win32-xpath library"
|
25
|
-
task :build => [:clean] do
|
26
|
-
require 'devkit' if CONFIG['host_os'] =~ /mingw|cygwin/i
|
27
|
-
Dir.chdir('ext') do
|
28
|
-
ruby "extconf.rb"
|
29
|
-
sh make
|
30
|
-
cp 'xpath.so', 'win32' # For testing
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
namespace :gem do
|
35
|
-
desc "Build the win32-xpath gem"
|
36
|
-
task :create => [:clean] do
|
37
|
-
require 'rubygems/package'
|
38
|
-
spec = eval(IO.read('win32-xpath.gemspec'))
|
39
|
-
Gem::Package.build(spec)
|
40
|
-
end
|
41
|
-
|
42
|
-
task "Install the win32-xpath gem"
|
43
|
-
task :install => [:create] do
|
44
|
-
file = Dir["*.gem"].first
|
45
|
-
sh "gem install -l #{file}"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
Rake::TestTask.new do |t|
|
50
|
-
task :test => [:build]
|
51
|
-
t.test_files = FileList['test/*']
|
52
|
-
t.libs << 'ext'
|
53
|
-
end
|
54
|
-
|
55
|
-
desc "Run benchmarks"
|
56
|
-
task :bench => [:build] do
|
57
|
-
ruby "-Iext bench/bench_win32_xpath.rb"
|
58
|
-
end
|
59
|
-
|
60
|
-
task :default => :test
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rbconfig'
|
5
|
+
include RbConfig
|
6
|
+
|
7
|
+
CLEAN.include(
|
8
|
+
'**/*.gem', # Gem files
|
9
|
+
'**/*.rbc', # Rubinius
|
10
|
+
'**/*.o', # C object file
|
11
|
+
'**/*.log', # Ruby extension build log
|
12
|
+
'**/Makefile', # C Makefile
|
13
|
+
'**/*.def', # Definition files
|
14
|
+
'**/*.exp',
|
15
|
+
'**/*.lib',
|
16
|
+
'**/*.pdb',
|
17
|
+
'**/*.obj',
|
18
|
+
'**/*.stackdump', # Junk that can happen on Windows
|
19
|
+
"**/*.#{CONFIG['DLEXT']}" # C shared object
|
20
|
+
)
|
21
|
+
|
22
|
+
make = CONFIG['host_os'] =~ /mingw|cygwin/i ? 'make' : 'nmake'
|
23
|
+
|
24
|
+
desc "Build the win32-xpath library"
|
25
|
+
task :build => [:clean] do
|
26
|
+
require 'devkit' if CONFIG['host_os'] =~ /mingw|cygwin/i
|
27
|
+
Dir.chdir('ext') do
|
28
|
+
ruby "extconf.rb"
|
29
|
+
sh make
|
30
|
+
cp 'xpath.so', 'win32' # For testing
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
namespace :gem do
|
35
|
+
desc "Build the win32-xpath gem"
|
36
|
+
task :create => [:clean] do
|
37
|
+
require 'rubygems/package'
|
38
|
+
spec = eval(IO.read('win32-xpath.gemspec'))
|
39
|
+
Gem::Package.build(spec)
|
40
|
+
end
|
41
|
+
|
42
|
+
task "Install the win32-xpath gem"
|
43
|
+
task :install => [:create] do
|
44
|
+
file = Dir["*.gem"].first
|
45
|
+
sh "gem install -l #{file}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
Rake::TestTask.new do |t|
|
50
|
+
task :test => [:build]
|
51
|
+
t.test_files = FileList['test/*']
|
52
|
+
t.libs << 'ext'
|
53
|
+
end
|
54
|
+
|
55
|
+
desc "Run benchmarks"
|
56
|
+
task :bench => [:build] do
|
57
|
+
ruby "-Iext bench/bench_win32_xpath.rb"
|
58
|
+
end
|
59
|
+
|
60
|
+
task :default => :test
|
data/bench/bench_win32_xpath.rb
CHANGED
@@ -1,79 +1,79 @@
|
|
1
|
-
require 'benchmark'
|
2
|
-
|
3
|
-
MAX = 100000
|
4
|
-
puts "\nOld File.expand_path"
|
5
|
-
|
6
|
-
Benchmark.bm(30) do |x|
|
7
|
-
x.report("expand_path('foo/bar')") do
|
8
|
-
str = "foo/bar"
|
9
|
-
MAX.times{ File.expand_path(str) }
|
10
|
-
end
|
11
|
-
|
12
|
-
x.report("expand_path('C:/foo/bar')") do
|
13
|
-
str = "C:/foo/bar"
|
14
|
-
MAX.times{ File.expand_path(str) }
|
15
|
-
end
|
16
|
-
|
17
|
-
x.report("expand_path('//foo/bar')") do
|
18
|
-
str = "//foo/bar"
|
19
|
-
MAX.times{ File.expand_path(str) }
|
20
|
-
end
|
21
|
-
|
22
|
-
x.report("expand_path('foo//bar///')") do
|
23
|
-
str = "foo//bar///"
|
24
|
-
MAX.times{ File.expand_path(str) }
|
25
|
-
end
|
26
|
-
|
27
|
-
x.report("expand_path('~')") do
|
28
|
-
str = "~"
|
29
|
-
MAX.times{ File.expand_path(str) }
|
30
|
-
end
|
31
|
-
|
32
|
-
x.report("expand_path('')") do
|
33
|
-
str = ""
|
34
|
-
MAX.times{ File.expand_path(str) }
|
35
|
-
end
|
36
|
-
|
37
|
-
x.report("expand_path('', '~')") do
|
38
|
-
MAX.times{ File.expand_path('', '~') }
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
require 'win32/xpath'
|
43
|
-
puts "\nNew File.expand_path\n"
|
44
|
-
|
45
|
-
Benchmark.bm(30) do |x|
|
46
|
-
x.report("expand_path('foo/bar')") do
|
47
|
-
str = "foo/bar"
|
48
|
-
MAX.times{ File.expand_path(str) }
|
49
|
-
end
|
50
|
-
|
51
|
-
x.report("expand_path('C:/foo/bar')") do
|
52
|
-
str = "C:/foo/bar"
|
53
|
-
MAX.times{ File.expand_path(str) }
|
54
|
-
end
|
55
|
-
|
56
|
-
x.report("expand_path('//foo/bar')") do
|
57
|
-
str = "//foo/bar"
|
58
|
-
MAX.times{ File.expand_path(str) }
|
59
|
-
end
|
60
|
-
|
61
|
-
x.report("expand_path('foo//bar///')") do
|
62
|
-
str = "foo//bar///"
|
63
|
-
MAX.times{ File.expand_path(str) }
|
64
|
-
end
|
65
|
-
|
66
|
-
x.report("expand_path('~')") do
|
67
|
-
str = "~"
|
68
|
-
MAX.times{ File.expand_path(str) }
|
69
|
-
end
|
70
|
-
|
71
|
-
x.report("expand_path('')") do
|
72
|
-
str = ""
|
73
|
-
MAX.times{ File.expand_path(str) }
|
74
|
-
end
|
75
|
-
|
76
|
-
x.report("expand_path('', '~')") do
|
77
|
-
MAX.times{ File.expand_path('', '~') }
|
78
|
-
end
|
79
|
-
end
|
1
|
+
require 'benchmark'
|
2
|
+
|
3
|
+
MAX = 100000
|
4
|
+
puts "\nOld File.expand_path"
|
5
|
+
|
6
|
+
Benchmark.bm(30) do |x|
|
7
|
+
x.report("expand_path('foo/bar')") do
|
8
|
+
str = "foo/bar"
|
9
|
+
MAX.times{ File.expand_path(str) }
|
10
|
+
end
|
11
|
+
|
12
|
+
x.report("expand_path('C:/foo/bar')") do
|
13
|
+
str = "C:/foo/bar"
|
14
|
+
MAX.times{ File.expand_path(str) }
|
15
|
+
end
|
16
|
+
|
17
|
+
x.report("expand_path('//foo/bar')") do
|
18
|
+
str = "//foo/bar"
|
19
|
+
MAX.times{ File.expand_path(str) }
|
20
|
+
end
|
21
|
+
|
22
|
+
x.report("expand_path('foo//bar///')") do
|
23
|
+
str = "foo//bar///"
|
24
|
+
MAX.times{ File.expand_path(str) }
|
25
|
+
end
|
26
|
+
|
27
|
+
x.report("expand_path('~')") do
|
28
|
+
str = "~"
|
29
|
+
MAX.times{ File.expand_path(str) }
|
30
|
+
end
|
31
|
+
|
32
|
+
x.report("expand_path('')") do
|
33
|
+
str = ""
|
34
|
+
MAX.times{ File.expand_path(str) }
|
35
|
+
end
|
36
|
+
|
37
|
+
x.report("expand_path('', '~')") do
|
38
|
+
MAX.times{ File.expand_path('', '~') }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
require 'win32/xpath'
|
43
|
+
puts "\nNew File.expand_path\n"
|
44
|
+
|
45
|
+
Benchmark.bm(30) do |x|
|
46
|
+
x.report("expand_path('foo/bar')") do
|
47
|
+
str = "foo/bar"
|
48
|
+
MAX.times{ File.expand_path(str) }
|
49
|
+
end
|
50
|
+
|
51
|
+
x.report("expand_path('C:/foo/bar')") do
|
52
|
+
str = "C:/foo/bar"
|
53
|
+
MAX.times{ File.expand_path(str) }
|
54
|
+
end
|
55
|
+
|
56
|
+
x.report("expand_path('//foo/bar')") do
|
57
|
+
str = "//foo/bar"
|
58
|
+
MAX.times{ File.expand_path(str) }
|
59
|
+
end
|
60
|
+
|
61
|
+
x.report("expand_path('foo//bar///')") do
|
62
|
+
str = "foo//bar///"
|
63
|
+
MAX.times{ File.expand_path(str) }
|
64
|
+
end
|
65
|
+
|
66
|
+
x.report("expand_path('~')") do
|
67
|
+
str = "~"
|
68
|
+
MAX.times{ File.expand_path(str) }
|
69
|
+
end
|
70
|
+
|
71
|
+
x.report("expand_path('')") do
|
72
|
+
str = ""
|
73
|
+
MAX.times{ File.expand_path(str) }
|
74
|
+
end
|
75
|
+
|
76
|
+
x.report("expand_path('', '~')") do
|
77
|
+
MAX.times{ File.expand_path('', '~') }
|
78
|
+
end
|
79
|
+
end
|