win32-xpath 1.0.3 → 1.1.2
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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGES.md +37 -0
- data/Gemfile +3 -0
- data/LICENSE +177 -0
- data/MANIFEST.md +14 -0
- data/README.md +64 -0
- data/Rakefile +4 -2
- data/appveyor.yml +36 -0
- data/bench/bench_win32_xpath.rb +1 -1
- data/certs/djberg96_pub.pem +26 -0
- data/ext/win32/xpath.c +69 -24
- data/lib/win32-xpath.rb +1 -0
- data/test/test_win32_xpath.rb +20 -2
- data/win32-xpath.gemspec +20 -12
- metadata +62 -24
- metadata.gz.sig +0 -0
- data/CHANGES +0 -11
- data/MANIFEST +0 -9
- data/README +0 -65
- data/futzing/futz.rb +0 -71
- data/futzing/test.rb +0 -90
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8f386aff8075f1869d7b1d5931145726e2f741a192c96a8ecb214adb95e57775
|
|
4
|
+
data.tar.gz: 5964f619e3c44bfcd183a9b9368dad576dc72ae5dba21b566fe372a9645d7a12
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 62429d580dafba1c74a90ba822365738ecadc6f00d231cb31e2a1665a955eb249dbe355914cce275613f3724aeba45aa11371470fc59b03b358a17defb20b6b6
|
|
7
|
+
data.tar.gz: f2d0ee1f647ea21b18854d19a1490dbf51e0335fd25925d4c08c4f6a21240c7a9ee400123a4cf554131cf154350d2f517440e9adc6801c72be886500e268bd41
|
checksums.yaml.gz.sig
ADDED
|
Binary file
|
data.tar.gz.sig
ADDED
|
Binary file
|
data/CHANGES.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
## 1.1.2 - 8-Aug-2021
|
|
2
|
+
* The relative path directory argument now accepts anything that responds
|
|
3
|
+
to the to_path method.
|
|
4
|
+
* Now skips taint checking tests on Ruby 2.7+
|
|
5
|
+
* Added a .gitignore file.
|
|
6
|
+
|
|
7
|
+
## 1.1.1 - 3-Mar-2019
|
|
8
|
+
* Switched RSTRING_PTR to StringValueCStr internally because apparently I
|
|
9
|
+
I didn't get the memo on null termination changes.
|
|
10
|
+
* Fixed a warning caused by rb_funcall by switching it to rb_funcall2.
|
|
11
|
+
* Fixed a bug where it would try to expand tildes for paths in 8.3 format.
|
|
12
|
+
Now tildes are only expanded if they are the first character in the path.
|
|
13
|
+
* Updated the cert.
|
|
14
|
+
* Updated the appveyor file to include Ruby 2.3, 2.4 and 2.5.
|
|
15
|
+
* Added a win32-xpath.rb file for convenience.
|
|
16
|
+
|
|
17
|
+
## 1.1.0 - 11-Jun-2016
|
|
18
|
+
* Changed license to Apache 2.0.
|
|
19
|
+
* Use PathCchXXX functions wherever I could that had not already been
|
|
20
|
+
put into place.
|
|
21
|
+
* Removed the "futzing" directory and contents.
|
|
22
|
+
* Added an appveyor.yml file.
|
|
23
|
+
|
|
24
|
+
## 1.0.4 - 26-Nov-2015
|
|
25
|
+
* This gem is now signed.
|
|
26
|
+
|
|
27
|
+
## 1.0.3 - 3-Jul-2015
|
|
28
|
+
* Use PathCchXXX functions where available to improve long path handling.
|
|
29
|
+
|
|
30
|
+
## 1.0.2 - 17-Jun-2015
|
|
31
|
+
* Deal with non-standard swprintf issues so that it works with mingw compiler.
|
|
32
|
+
|
|
33
|
+
## 1.0.1 - 2-Apr-2015
|
|
34
|
+
* Altered internal handling of native C function failures.
|
|
35
|
+
|
|
36
|
+
## 1.0.0 - 26-Feb-2015
|
|
37
|
+
* Initial release
|
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
data/MANIFEST.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
* appveyor.yml
|
|
2
|
+
* bench/bench_win32_xpath.rb
|
|
3
|
+
* CHANGES.md
|
|
4
|
+
* certs/djberg96_pub.pem
|
|
5
|
+
* ext/extconf.rb
|
|
6
|
+
* ext/win32/xpath.c
|
|
7
|
+
* Gemfile
|
|
8
|
+
* lib/win32-xpath.rb
|
|
9
|
+
* LICENSE
|
|
10
|
+
* MANIFEST.md
|
|
11
|
+
* Rakefile
|
|
12
|
+
* README.md
|
|
13
|
+
* test/test_win32_xpath.rb
|
|
14
|
+
* win32-xpath.gemspec
|
data/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
A custom `File.expand_path` method for Ruby on Windows that's much faster and works better.
|
|
3
|
+
|
|
4
|
+
## Installation
|
|
5
|
+
`gem install win32-xpath`
|
|
6
|
+
|
|
7
|
+
## Synopsis
|
|
8
|
+
```ruby
|
|
9
|
+
require 'win32/xpath'
|
|
10
|
+
|
|
11
|
+
# That's it, you are now using this library when you call File.expand_path
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
* A 5x average performance boost over MRI's current method.
|
|
16
|
+
* Support for ~user expansion.
|
|
17
|
+
|
|
18
|
+
## Known Issues
|
|
19
|
+
* This library does not support drive-current paths for the 2nd argument.
|
|
20
|
+
* This library does not support alt-stream name autocorrection.
|
|
21
|
+
* This library does not convert short paths to long paths.
|
|
22
|
+
|
|
23
|
+
It is very unlikely you will ever be affected by any of these things.
|
|
24
|
+
Drive-current paths are a relic of DOS 1.0, but even so this library
|
|
25
|
+
will handle them in the first argument.
|
|
26
|
+
|
|
27
|
+
I don't support alt-stream mangling because I don't believe it's the
|
|
28
|
+
job of this method to peform autocorrection. Even in MRI it only works
|
|
29
|
+
for the default $DATA stream, and then only for a certain type of
|
|
30
|
+
syntax error. I do not know when or why it was added.
|
|
31
|
+
|
|
32
|
+
Failure to convert short paths to long paths is irrelevant since that
|
|
33
|
+
has nothing to do with relative versus absolute paths.
|
|
34
|
+
|
|
35
|
+
One possible "real" issue is that on Windows 7 or earlier you will be
|
|
36
|
+
limited to 260 character paths. This is a limitation of the shlwapi.h
|
|
37
|
+
functions that I use internally.
|
|
38
|
+
|
|
39
|
+
If you discover any other issues, please report them on the project
|
|
40
|
+
page at https://github.com/djberg96/win32-xpath.
|
|
41
|
+
|
|
42
|
+
## Mingw and Devkit
|
|
43
|
+
Make sure you have a recent version of the Devkit installed if you're
|
|
44
|
+
using the one-click installer. If you see this warning then you need
|
|
45
|
+
to upgrade your Devkit.
|
|
46
|
+
|
|
47
|
+
`"implicit declaration of function 'ConvertSidToStringSidW'"`
|
|
48
|
+
|
|
49
|
+
## Acknowledgements
|
|
50
|
+
Park Heesob for encoding advice and help.
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
Apache-2.0
|
|
54
|
+
|
|
55
|
+
## Copyright
|
|
56
|
+
(C) 2003-2019 Daniel J. Berger, All Rights Reserved
|
|
57
|
+
|
|
58
|
+
## Warranty
|
|
59
|
+
This package is provided "as is" and without any express or
|
|
60
|
+
implied warranties, including, without limitation, the implied
|
|
61
|
+
warranties of merchantability and fitness for a particular purpose.
|
|
62
|
+
|
|
63
|
+
## Author
|
|
64
|
+
Daniel Berger
|
data/Rakefile
CHANGED
|
@@ -7,6 +7,7 @@ include RbConfig
|
|
|
7
7
|
CLEAN.include(
|
|
8
8
|
'**/*.gem', # Gem files
|
|
9
9
|
'**/*.rbc', # Rubinius
|
|
10
|
+
'**/*.lock', # Bundler
|
|
10
11
|
'**/*.o', # C object file
|
|
11
12
|
'**/*.log', # Ruby extension build log
|
|
12
13
|
'**/Makefile', # C Makefile
|
|
@@ -35,8 +36,9 @@ namespace :gem do
|
|
|
35
36
|
desc "Build the win32-xpath gem"
|
|
36
37
|
task :create => [:clean] do
|
|
37
38
|
require 'rubygems/package'
|
|
38
|
-
spec =
|
|
39
|
-
|
|
39
|
+
spec = Gem::Specification.load('win32-xpath.gemspec')
|
|
40
|
+
spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
|
|
41
|
+
Gem::Package.build(spec, true)
|
|
40
42
|
end
|
|
41
43
|
|
|
42
44
|
task "Install the win32-xpath gem"
|
data/appveyor.yml
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
version: '{build}'
|
|
2
|
+
branches:
|
|
3
|
+
only:
|
|
4
|
+
- master
|
|
5
|
+
- appveyor
|
|
6
|
+
skip_tags: true
|
|
7
|
+
environment:
|
|
8
|
+
matrix:
|
|
9
|
+
- ruby_version: 22-x64
|
|
10
|
+
ruby_dir: 2.2.0
|
|
11
|
+
- ruby_version: 23-x64
|
|
12
|
+
ruby_dir: 2.3.0
|
|
13
|
+
- ruby_version: 24-x64
|
|
14
|
+
ruby_dir: 2.4.0
|
|
15
|
+
- ruby_version: 25-x64
|
|
16
|
+
ruby_dir: 2.5.0
|
|
17
|
+
install:
|
|
18
|
+
- ps: >-
|
|
19
|
+
$env:path = "C:\Ruby" + $env:ruby_version + "\bin;" + $env:path
|
|
20
|
+
|
|
21
|
+
$tpath = "C:\Ruby" + $env:ruby_version + "\lib\ruby\" + $env:ruby_dir + "\test"
|
|
22
|
+
|
|
23
|
+
if ((test-path $tpath) -eq $True){ rm -recurse -force $tpath }
|
|
24
|
+
|
|
25
|
+
gem update --system > $null
|
|
26
|
+
|
|
27
|
+
if ((gem query -i test-unit -v ">= 3.0") -eq $False){ gem install test-unit --no-document }
|
|
28
|
+
cache:
|
|
29
|
+
- C:\Ruby22-x64\lib\ruby\gems\2.2.0
|
|
30
|
+
- C:\Ruby23-x64\lib\ruby\gems\2.3.0
|
|
31
|
+
- C:\Ruby24-x64\lib\ruby\gems\2.4.0
|
|
32
|
+
- C:\Ruby25-x64\lib\ruby\gems\2.5.0
|
|
33
|
+
build: off
|
|
34
|
+
test_script:
|
|
35
|
+
- cmd: rake
|
|
36
|
+
deploy: off
|
data/bench/bench_win32_xpath.rb
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
|
2
|
+
MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MREwDwYDVQQDDAhkamJl
|
|
3
|
+
cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
|
4
|
+
MB4XDTE4MDMxODE1MjIwN1oXDTI4MDMxNTE1MjIwN1owPzERMA8GA1UEAwwIZGpi
|
|
5
|
+
ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
|
6
|
+
bTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBALgfaroVM6CI06cxr0/h
|
|
7
|
+
A+j+pc8fgpRgBVmHFaFunq28GPC3IvW7Nvc3Y8SnAW7pP1EQIbhlwRIaQzJ93/yj
|
|
8
|
+
u95KpkP7tA9erypnV7dpzBkzNlX14ACaFD/6pHoXoe2ltBxk3CCyyzx70mTqJpph
|
|
9
|
+
75IB03ni9a8yqn8pmse+s83bFJOAqddSj009sGPcQO+QOWiNxqYv1n5EHcvj2ebO
|
|
10
|
+
6hN7YTmhx7aSia4qL/quc4DlIaGMWoAhvML7u1fmo53CYxkKskfN8MOecq2vfEmL
|
|
11
|
+
iLu+SsVVEAufMDDFMXMJlvDsviolUSGMSNRTujkyCcJoXKYYxZSNtIiyd9etI0X3
|
|
12
|
+
ctu0uhrFyrMZXCedutvXNjUolD5r9KGBFSWH1R9u2I3n3SAyFF2yzv/7idQHLJJq
|
|
13
|
+
74BMnx0FIq6fCpu5slAipvxZ3ZkZpEXZFr3cIBtO1gFvQWW7E/Y3ijliWJS1GQFq
|
|
14
|
+
058qERadHGu1yu1dojmFRo6W2KZvY9al2yIlbkpDrD5MYQIDAQABo3cwdTAJBgNV
|
|
15
|
+
HRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUFZsMapgzJimzsbaBG2Tm8j5e
|
|
16
|
+
AzgwHQYDVR0RBBYwFIESZGpiZXJnOTZAZ21haWwuY29tMB0GA1UdEgQWMBSBEmRq
|
|
17
|
+
YmVyZzk2QGdtYWlsLmNvbTANBgkqhkiG9w0BAQsFAAOCAYEAW2tnYixXQtKxgGXq
|
|
18
|
+
/3iSWG2bLwvxS4go3srO+aRXZHrFUMlJ5W0mCxl03aazxxKTsVVpZD8QZxvK91OQ
|
|
19
|
+
h9zr9JBYqCLcCVbr8SkmYCi/laxIZxsNE5YI8cC8vvlLI7AMgSfPSnn/Epq1GjGY
|
|
20
|
+
6L1iRcEDtanGCIvjqlCXO9+BmsnCfEVehqZkQHeYczA03tpOWb6pon2wzvMKSsKH
|
|
21
|
+
ks0ApVdstSLz1kzzAqem/uHdG9FyXdbTAwH1G4ZPv69sQAFAOCgAqYmdnzedsQtE
|
|
22
|
+
1LQfaQrx0twO+CZJPcRLEESjq8ScQxWRRkfuh2VeR7cEU7L7KqT10mtUwrvw7APf
|
|
23
|
+
DYoeCY9KyjIBjQXfbj2ke5u1hZj94Fsq9FfbEQg8ygCgwThnmkTrrKEiMSs3alYR
|
|
24
|
+
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
|
25
|
+
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
|
26
|
+
-----END CERTIFICATE-----
|
data/ext/win32/xpath.c
CHANGED
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
|
|
11
11
|
#ifdef HAVE_PATHCCH_H
|
|
12
12
|
#include <pathcch.h>
|
|
13
|
-
#
|
|
14
|
-
|
|
13
|
+
#define MAX_WPATH PATHCCH_MAX_CCH
|
|
14
|
+
#else
|
|
15
15
|
#define MAX_WPATH MAX_PATH * sizeof(wchar_t)
|
|
16
|
+
#endif
|
|
16
17
|
|
|
17
18
|
// Equivalent to raise SystemCallError.new(string, errnum)
|
|
18
19
|
void rb_raise_syserr(const char* msg, DWORD errnum){
|
|
@@ -119,6 +120,9 @@ wchar_t* expand_tilde(){
|
|
|
119
120
|
wchar_t* temp;
|
|
120
121
|
const wchar_t* env2 = L"HOMEPATH";
|
|
121
122
|
env = L"HOMEDRIVE";
|
|
123
|
+
#ifdef HAVE_PATHCCH_H
|
|
124
|
+
HRESULT hr;
|
|
125
|
+
#endif
|
|
122
126
|
|
|
123
127
|
// If neither are found then raise an error
|
|
124
128
|
size = GetEnvironmentVariableW(env, NULL, 0);
|
|
@@ -140,8 +144,20 @@ wchar_t* expand_tilde(){
|
|
|
140
144
|
rb_raise_syserr("GetEnvironmentVariable", GetLastError());
|
|
141
145
|
}
|
|
142
146
|
|
|
143
|
-
|
|
147
|
+
#ifdef HAVE_PATHCCH_H
|
|
148
|
+
hr = PathCchAppendEx(home, MAX_WPATH, temp, 1);
|
|
149
|
+
if(hr != S_OK){
|
|
150
|
+
ruby_xfree(home);
|
|
151
|
+
ruby_xfree(temp);
|
|
152
|
+
rb_raise_syserr("PathCchAppendEx", hr);
|
|
153
|
+
}
|
|
154
|
+
#else
|
|
155
|
+
if(!PathAppendW(home, temp)){
|
|
156
|
+
ruby_xfree(home);
|
|
157
|
+
ruby_xfree(temp);
|
|
144
158
|
rb_raise_syserr("PathAppend", GetLastError());
|
|
159
|
+
}
|
|
160
|
+
#endif
|
|
145
161
|
}
|
|
146
162
|
else{
|
|
147
163
|
home = (wchar_t*)ruby_xmalloc(MAX_WPATH);
|
|
@@ -185,12 +201,16 @@ static VALUE rb_xpath(int argc, VALUE* argv, VALUE self){
|
|
|
185
201
|
rb_scan_args(argc, argv, "11", &v_path_orig, &v_dir_orig);
|
|
186
202
|
|
|
187
203
|
if (rb_respond_to(v_path_orig, rb_intern("to_path")))
|
|
188
|
-
v_path_orig =
|
|
204
|
+
v_path_orig = rb_funcall2(v_path_orig, rb_intern("to_path"), 0, NULL);
|
|
189
205
|
|
|
190
206
|
SafeStringValue(v_path_orig);
|
|
191
207
|
|
|
192
|
-
if (!NIL_P(v_dir_orig))
|
|
208
|
+
if (!NIL_P(v_dir_orig)){
|
|
209
|
+
if (rb_respond_to(v_dir_orig, rb_intern("to_path")))
|
|
210
|
+
v_dir_orig = rb_funcall2(v_dir_orig, rb_intern("to_path"), 0, NULL);
|
|
211
|
+
|
|
193
212
|
SafeStringValue(v_dir_orig);
|
|
213
|
+
}
|
|
194
214
|
|
|
195
215
|
// Dup and prep string for modification
|
|
196
216
|
path_encoding = rb_enc_get(v_path_orig);
|
|
@@ -204,13 +224,13 @@ static VALUE rb_xpath(int argc, VALUE* argv, VALUE self){
|
|
|
204
224
|
rb_econv_close(ec);
|
|
205
225
|
}
|
|
206
226
|
|
|
207
|
-
rb_str_modify_expand(v_path,
|
|
227
|
+
rb_str_modify_expand(v_path, MAX_WPATH);
|
|
208
228
|
|
|
209
229
|
// Make our path a wide string for later functions
|
|
210
|
-
length = MultiByteToWideChar(CP_UTF8, 0,
|
|
230
|
+
length = MultiByteToWideChar(CP_UTF8, 0, StringValueCStr(v_path), -1, NULL, 0);
|
|
211
231
|
path = (wchar_t*)ruby_xmalloc(length * sizeof(wchar_t));
|
|
212
232
|
|
|
213
|
-
if(!MultiByteToWideChar(CP_UTF8, 0,
|
|
233
|
+
if(!MultiByteToWideChar(CP_UTF8, 0, StringValueCStr(v_path), -1, path, length)){
|
|
214
234
|
ruby_xfree(path);
|
|
215
235
|
rb_raise_syserr("MultibyteToWideChar", GetLastError());
|
|
216
236
|
}
|
|
@@ -219,8 +239,8 @@ static VALUE rb_xpath(int argc, VALUE* argv, VALUE self){
|
|
|
219
239
|
while(wcsstr(path, L"/"))
|
|
220
240
|
path[wcscspn(path, L"/")] = L'\\';
|
|
221
241
|
|
|
222
|
-
// Handle ~ expansion.
|
|
223
|
-
if (ptr = wcschr(path, L'~')){
|
|
242
|
+
// Handle ~ expansion if first character.
|
|
243
|
+
if ( (ptr = wcschr(path, L'~')) && ((int)(ptr - path) == 0) ){
|
|
224
244
|
wchar_t* home;
|
|
225
245
|
|
|
226
246
|
// Handle both ~/user and ~user syntax
|
|
@@ -229,17 +249,15 @@ static VALUE rb_xpath(int argc, VALUE* argv, VALUE self){
|
|
|
229
249
|
}
|
|
230
250
|
else{
|
|
231
251
|
#ifdef HAVE_PATHCCHAPPENDEX
|
|
232
|
-
HRESULT
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
wcscpy_s(buffer, PATHCCH_MAX_CCH, expand_tilde(path));
|
|
236
|
-
|
|
237
|
-
result = PathCchAppendEx(buffer, MAX_PATH, ++ptr, PATHCCH_ALLOW_LONG_PATHS);
|
|
252
|
+
HRESULT hr;
|
|
253
|
+
home = expand_tilde(path);
|
|
238
254
|
|
|
239
|
-
|
|
240
|
-
rb_raise_syserr("PathCchAppend", result);
|
|
255
|
+
hr = PathCchAppendEx(home, MAX_WPATH, ++ptr, 1);
|
|
241
256
|
|
|
242
|
-
|
|
257
|
+
if(hr != S_OK){
|
|
258
|
+
ruby_xfree(home);
|
|
259
|
+
rb_raise_syserr("PathCchAppendEx", hr);
|
|
260
|
+
}
|
|
243
261
|
#else
|
|
244
262
|
home = expand_tilde(path);
|
|
245
263
|
|
|
@@ -258,6 +276,9 @@ static VALUE rb_xpath(int argc, VALUE* argv, VALUE self){
|
|
|
258
276
|
wchar_t* dir;
|
|
259
277
|
VALUE v_dir;
|
|
260
278
|
rb_encoding* dir_encoding;
|
|
279
|
+
#ifdef HAVE_PATHCCH_H
|
|
280
|
+
HRESULT hr;
|
|
281
|
+
#endif
|
|
261
282
|
|
|
262
283
|
dir_encoding = rb_enc_get(v_dir_orig);
|
|
263
284
|
|
|
@@ -272,12 +293,12 @@ static VALUE rb_xpath(int argc, VALUE* argv, VALUE self){
|
|
|
272
293
|
}
|
|
273
294
|
|
|
274
295
|
// Prep string for modification
|
|
275
|
-
rb_str_modify_expand(v_dir,
|
|
296
|
+
rb_str_modify_expand(v_dir, MAX_WPATH);
|
|
276
297
|
|
|
277
|
-
length = MultiByteToWideChar(CP_UTF8, 0,
|
|
278
|
-
dir = (wchar_t*)ruby_xmalloc(
|
|
298
|
+
length = MultiByteToWideChar(CP_UTF8, 0, StringValueCStr(v_dir), -1, NULL, 0);
|
|
299
|
+
dir = (wchar_t*)ruby_xmalloc(MAX_WPATH * sizeof(wchar_t));
|
|
279
300
|
|
|
280
|
-
if (!MultiByteToWideChar(CP_UTF8, 0,
|
|
301
|
+
if (!MultiByteToWideChar(CP_UTF8, 0, StringValueCStr(v_dir), -1, dir, length)){
|
|
281
302
|
ruby_xfree(dir);
|
|
282
303
|
rb_raise_syserr("MultibyteToWideChar", GetLastError());
|
|
283
304
|
}
|
|
@@ -285,17 +306,27 @@ static VALUE rb_xpath(int argc, VALUE* argv, VALUE self){
|
|
|
285
306
|
while (wcsstr(dir, L"/"))
|
|
286
307
|
dir[wcscspn(dir, L"/")] = L'\\';
|
|
287
308
|
|
|
288
|
-
|
|
309
|
+
// Check for tilde in first character
|
|
310
|
+
if ( (ptr = wcschr(dir, L'~')) && ((int)(ptr - dir) == 0) ){
|
|
289
311
|
if (ptr[1] && ptr[1] != L'\\'){
|
|
290
312
|
dir = find_user(++ptr);
|
|
291
313
|
}
|
|
292
314
|
else{
|
|
293
315
|
dir = expand_tilde();
|
|
294
316
|
|
|
317
|
+
#ifdef HAVE_PATHCCH_H
|
|
318
|
+
hr = PathCchAppendEx(dir, MAX_WPATH, ++ptr, 1);
|
|
319
|
+
|
|
320
|
+
if(hr != S_OK){
|
|
321
|
+
ruby_xfree(dir);
|
|
322
|
+
rb_raise_syserr("PathCchAppendEx", hr);
|
|
323
|
+
}
|
|
324
|
+
#else
|
|
295
325
|
if (!PathAppendW(dir, ++ptr)){
|
|
296
326
|
ruby_xfree(dir);
|
|
297
327
|
rb_raise_syserr("PathAppend", GetLastError());
|
|
298
328
|
}
|
|
329
|
+
#endif
|
|
299
330
|
}
|
|
300
331
|
}
|
|
301
332
|
|
|
@@ -303,10 +334,20 @@ static VALUE rb_xpath(int argc, VALUE* argv, VALUE self){
|
|
|
303
334
|
path = dir;
|
|
304
335
|
|
|
305
336
|
if (PathIsRelativeW(path)){
|
|
337
|
+
|
|
338
|
+
#ifdef HAVE_PATHCCH_H
|
|
339
|
+
hr = PathCchAppendEx(dir, MAX_WPATH, path, 1);
|
|
340
|
+
|
|
341
|
+
if(hr != S_OK){
|
|
342
|
+
ruby_xfree(dir);
|
|
343
|
+
rb_raise_syserr("PathCchAppendEx", hr);
|
|
344
|
+
}
|
|
345
|
+
#else
|
|
306
346
|
if(!PathAppendW(dir, path)){
|
|
307
347
|
ruby_xfree(dir);
|
|
308
348
|
rb_raise_syserr("PathAppend", GetLastError());
|
|
309
349
|
}
|
|
350
|
+
#endif
|
|
310
351
|
|
|
311
352
|
// Remove leading slashes from relative paths
|
|
312
353
|
if (dir[0] == L'\\')
|
|
@@ -350,7 +391,11 @@ static VALUE rb_xpath(int argc, VALUE* argv, VALUE self){
|
|
|
350
391
|
}
|
|
351
392
|
|
|
352
393
|
// Strip all trailing backslashes
|
|
394
|
+
#ifdef HAVE_PATHCCH_H
|
|
395
|
+
while (PathCchRemoveBackslash(path, wcslen(path)+1) == S_OK);
|
|
396
|
+
#else
|
|
353
397
|
while (!*PathRemoveBackslashW(path));
|
|
398
|
+
#endif
|
|
354
399
|
|
|
355
400
|
// First call, get the length
|
|
356
401
|
length = GetFullPathNameW(path, 0, buffer, NULL);
|
data/lib/win32-xpath.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'win32/xpath'
|
data/test/test_win32_xpath.rb
CHANGED
|
@@ -11,7 +11,7 @@ class Test_XPath < Test::Unit::TestCase
|
|
|
11
11
|
|
|
12
12
|
def setup
|
|
13
13
|
@pwd = Dir.pwd
|
|
14
|
-
@tmp =
|
|
14
|
+
@tmp = 'C:/Temp'
|
|
15
15
|
@root = 'C:/'
|
|
16
16
|
@drive = ENV['HOMEDRIVE']
|
|
17
17
|
@home = ENV['HOME'].tr('\\', '/')
|
|
@@ -65,6 +65,12 @@ class Test_XPath < Test::Unit::TestCase
|
|
|
65
65
|
assert_equal(File.join(@root, 'foo.rb'), File.expand_path("#{@root}foo.rb/"))
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
+
test "removes trailing slashes from relative path" do
|
|
69
|
+
assert_equal(File.join(@pwd, 'foo'), File.expand_path("foo/"))
|
|
70
|
+
assert_equal(File.join(@pwd, 'foo'), File.expand_path("foo//"))
|
|
71
|
+
assert_equal(File.join(@pwd, 'foo'), File.expand_path("foo\\\\\\"))
|
|
72
|
+
end
|
|
73
|
+
|
|
68
74
|
test "removes trailing spaces from absolute path" do
|
|
69
75
|
assert_equal(File.join(@root, 'foo'), File.expand_path("#{@root}foo "))
|
|
70
76
|
end
|
|
@@ -86,6 +92,7 @@ class Test_XPath < Test::Unit::TestCase
|
|
|
86
92
|
end
|
|
87
93
|
|
|
88
94
|
test "returns tainted strings or not" do
|
|
95
|
+
omit_if(RUBY_VERSION.to_f >= 2.7, "skipping taint checks on Ruby 2.7+")
|
|
89
96
|
assert_true(File.expand_path('foo').tainted?)
|
|
90
97
|
assert_true(File.expand_path('foo'.taint).tainted?)
|
|
91
98
|
assert_true(File.expand_path('/foo').tainted?)
|
|
@@ -112,6 +119,11 @@ class Test_XPath < Test::Unit::TestCase
|
|
|
112
119
|
assert_equal("#{@home}/foo", File.expand_path('foo', '~'))
|
|
113
120
|
end
|
|
114
121
|
|
|
122
|
+
test "doesn't attempt to expand a tilde unless it's the first character" do
|
|
123
|
+
assert_equal("C:/Progra~1", File.expand_path("C:/Progra~1"))
|
|
124
|
+
assert_equal("C:/Progra~1", File.expand_path("C:/Progra~1", "C:/Progra~1"))
|
|
125
|
+
end
|
|
126
|
+
|
|
115
127
|
test "does not modify a HOME string argument" do
|
|
116
128
|
str = "~/a"
|
|
117
129
|
assert_equal("#{@home}/a", File.expand_path(str))
|
|
@@ -168,12 +180,18 @@ class Test_XPath < Test::Unit::TestCase
|
|
|
168
180
|
assert_equal("./a/b/../c", str)
|
|
169
181
|
end
|
|
170
182
|
|
|
171
|
-
test "accepts objects that have a to_path method" do
|
|
183
|
+
test "accepts objects that have a to_path method for main argument" do
|
|
172
184
|
klass = Class.new{ def to_path; "a/b/c"; end }
|
|
173
185
|
obj = klass.new
|
|
174
186
|
assert_equal("#{@pwd}/a/b/c", File.expand_path(obj))
|
|
175
187
|
end
|
|
176
188
|
|
|
189
|
+
test "accepts objects that have a to_path method for relative dir argument" do
|
|
190
|
+
klass = Class.new{ def to_path; "bar"; end }
|
|
191
|
+
obj = klass.new
|
|
192
|
+
assert_equal("#{@pwd}/bar/foo", File.expand_path('foo', obj))
|
|
193
|
+
end
|
|
194
|
+
|
|
177
195
|
test "works with unicode characters" do
|
|
178
196
|
assert_equal("#{@pwd}/Ελλάσ", File.expand_path("Ελλάσ"))
|
|
179
197
|
end
|
data/win32-xpath.gemspec
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
require 'rubygems'
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |spec|
|
|
4
|
-
spec.name
|
|
5
|
-
spec.version
|
|
6
|
-
spec.author
|
|
7
|
-
spec.license
|
|
8
|
-
spec.email
|
|
9
|
-
spec.homepage
|
|
10
|
-
spec.summary
|
|
11
|
-
spec.test_file
|
|
12
|
-
spec.files
|
|
13
|
-
|
|
14
|
-
spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
|
|
4
|
+
spec.name = 'win32-xpath'
|
|
5
|
+
spec.version = '1.1.2'
|
|
6
|
+
spec.author = 'Daniel J. Berger'
|
|
7
|
+
spec.license = 'Apache-2.0'
|
|
8
|
+
spec.email = 'djberg96@gmail.com'
|
|
9
|
+
spec.homepage = 'http://github.com/djberg96/win32-xpath'
|
|
10
|
+
spec.summary = 'Revamped File.expand_path for Windows'
|
|
11
|
+
spec.test_file = 'test/test_win32_xpath.rb'
|
|
12
|
+
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
|
13
|
+
spec.cert_chain = Dir['certs/*']
|
|
15
14
|
|
|
16
15
|
spec.extensions = ['ext/extconf.rb']
|
|
17
16
|
spec.add_development_dependency('rake')
|
|
18
|
-
spec.add_development_dependency('test-unit', '
|
|
17
|
+
spec.add_development_dependency('test-unit', '~> 3.4')
|
|
18
|
+
|
|
19
|
+
spec.metadata = {
|
|
20
|
+
'homepage_uri' => 'https://github.com/djberg96/win32-xpath',
|
|
21
|
+
'bug_tracker_uri' => 'https://github.com/djberg96/win32-xpath/issues',
|
|
22
|
+
'changelog_uri' => 'https://github.com/djberg96/win32-xpath/blob/main/CHANGES.md',
|
|
23
|
+
'documentation_uri' => 'https://github.com/djberg96/win32-xpath/wiki',
|
|
24
|
+
'source_code_uri' => 'https://github.com/djberg96/win32-xpath',
|
|
25
|
+
'wiki_uri' => 'https://github.com/djberg96/win32-xpath/wiki'
|
|
26
|
+
}
|
|
19
27
|
|
|
20
28
|
spec.description = <<-EOF
|
|
21
29
|
The win32-xpath library provides a revamped File.expand_path method
|
metadata
CHANGED
|
@@ -1,14 +1,41 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: win32-xpath
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel J. Berger
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
|
-
cert_chain:
|
|
11
|
-
|
|
10
|
+
cert_chain:
|
|
11
|
+
- |
|
|
12
|
+
-----BEGIN CERTIFICATE-----
|
|
13
|
+
MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MREwDwYDVQQDDAhkamJl
|
|
14
|
+
cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
|
15
|
+
MB4XDTE4MDMxODE1MjIwN1oXDTI4MDMxNTE1MjIwN1owPzERMA8GA1UEAwwIZGpi
|
|
16
|
+
ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
|
17
|
+
bTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBALgfaroVM6CI06cxr0/h
|
|
18
|
+
A+j+pc8fgpRgBVmHFaFunq28GPC3IvW7Nvc3Y8SnAW7pP1EQIbhlwRIaQzJ93/yj
|
|
19
|
+
u95KpkP7tA9erypnV7dpzBkzNlX14ACaFD/6pHoXoe2ltBxk3CCyyzx70mTqJpph
|
|
20
|
+
75IB03ni9a8yqn8pmse+s83bFJOAqddSj009sGPcQO+QOWiNxqYv1n5EHcvj2ebO
|
|
21
|
+
6hN7YTmhx7aSia4qL/quc4DlIaGMWoAhvML7u1fmo53CYxkKskfN8MOecq2vfEmL
|
|
22
|
+
iLu+SsVVEAufMDDFMXMJlvDsviolUSGMSNRTujkyCcJoXKYYxZSNtIiyd9etI0X3
|
|
23
|
+
ctu0uhrFyrMZXCedutvXNjUolD5r9KGBFSWH1R9u2I3n3SAyFF2yzv/7idQHLJJq
|
|
24
|
+
74BMnx0FIq6fCpu5slAipvxZ3ZkZpEXZFr3cIBtO1gFvQWW7E/Y3ijliWJS1GQFq
|
|
25
|
+
058qERadHGu1yu1dojmFRo6W2KZvY9al2yIlbkpDrD5MYQIDAQABo3cwdTAJBgNV
|
|
26
|
+
HRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUFZsMapgzJimzsbaBG2Tm8j5e
|
|
27
|
+
AzgwHQYDVR0RBBYwFIESZGpiZXJnOTZAZ21haWwuY29tMB0GA1UdEgQWMBSBEmRq
|
|
28
|
+
YmVyZzk2QGdtYWlsLmNvbTANBgkqhkiG9w0BAQsFAAOCAYEAW2tnYixXQtKxgGXq
|
|
29
|
+
/3iSWG2bLwvxS4go3srO+aRXZHrFUMlJ5W0mCxl03aazxxKTsVVpZD8QZxvK91OQ
|
|
30
|
+
h9zr9JBYqCLcCVbr8SkmYCi/laxIZxsNE5YI8cC8vvlLI7AMgSfPSnn/Epq1GjGY
|
|
31
|
+
6L1iRcEDtanGCIvjqlCXO9+BmsnCfEVehqZkQHeYczA03tpOWb6pon2wzvMKSsKH
|
|
32
|
+
ks0ApVdstSLz1kzzAqem/uHdG9FyXdbTAwH1G4ZPv69sQAFAOCgAqYmdnzedsQtE
|
|
33
|
+
1LQfaQrx0twO+CZJPcRLEESjq8ScQxWRRkfuh2VeR7cEU7L7KqT10mtUwrvw7APf
|
|
34
|
+
DYoeCY9KyjIBjQXfbj2ke5u1hZj94Fsq9FfbEQg8ygCgwThnmkTrrKEiMSs3alYR
|
|
35
|
+
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
|
36
|
+
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
|
37
|
+
-----END CERTIFICATE-----
|
|
38
|
+
date:
|
|
12
39
|
dependencies:
|
|
13
40
|
- !ruby/object:Gem::Dependency
|
|
14
41
|
name: rake
|
|
@@ -28,16 +55,16 @@ dependencies:
|
|
|
28
55
|
name: test-unit
|
|
29
56
|
requirement: !ruby/object:Gem::Requirement
|
|
30
57
|
requirements:
|
|
31
|
-
- - "
|
|
58
|
+
- - "~>"
|
|
32
59
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 3.
|
|
60
|
+
version: '3.4'
|
|
34
61
|
type: :development
|
|
35
62
|
prerelease: false
|
|
36
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
64
|
requirements:
|
|
38
|
-
- - "
|
|
65
|
+
- - "~>"
|
|
39
66
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 3.
|
|
67
|
+
version: '3.4'
|
|
41
68
|
description: |2
|
|
42
69
|
The win32-xpath library provides a revamped File.expand_path method
|
|
43
70
|
for MS Windows. It is significantly faster, and supports ~user
|
|
@@ -46,27 +73,39 @@ email: djberg96@gmail.com
|
|
|
46
73
|
executables: []
|
|
47
74
|
extensions:
|
|
48
75
|
- ext/extconf.rb
|
|
49
|
-
extra_rdoc_files:
|
|
50
|
-
- README
|
|
51
|
-
- CHANGES
|
|
52
|
-
- MANIFEST
|
|
76
|
+
extra_rdoc_files: []
|
|
53
77
|
files:
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
- README
|
|
57
|
-
- Rakefile
|
|
78
|
+
- appveyor.yml
|
|
79
|
+
- bench
|
|
58
80
|
- bench/bench_win32_xpath.rb
|
|
81
|
+
- certs
|
|
82
|
+
- certs/djberg96_pub.pem
|
|
83
|
+
- CHANGES.md
|
|
84
|
+
- ext
|
|
59
85
|
- ext/extconf.rb
|
|
86
|
+
- ext/win32
|
|
60
87
|
- ext/win32/xpath.c
|
|
61
|
-
-
|
|
62
|
-
-
|
|
88
|
+
- Gemfile
|
|
89
|
+
- lib
|
|
90
|
+
- lib/win32-xpath.rb
|
|
91
|
+
- LICENSE
|
|
92
|
+
- MANIFEST.md
|
|
93
|
+
- Rakefile
|
|
94
|
+
- README.md
|
|
95
|
+
- test
|
|
63
96
|
- test/test_win32_xpath.rb
|
|
64
97
|
- win32-xpath.gemspec
|
|
65
98
|
homepage: http://github.com/djberg96/win32-xpath
|
|
66
99
|
licenses:
|
|
67
|
-
-
|
|
68
|
-
metadata:
|
|
69
|
-
|
|
100
|
+
- Apache-2.0
|
|
101
|
+
metadata:
|
|
102
|
+
homepage_uri: https://github.com/djberg96/win32-xpath
|
|
103
|
+
bug_tracker_uri: https://github.com/djberg96/win32-xpath/issues
|
|
104
|
+
changelog_uri: https://github.com/djberg96/win32-xpath/blob/main/CHANGES.md
|
|
105
|
+
documentation_uri: https://github.com/djberg96/win32-xpath/wiki
|
|
106
|
+
source_code_uri: https://github.com/djberg96/win32-xpath
|
|
107
|
+
wiki_uri: https://github.com/djberg96/win32-xpath/wiki
|
|
108
|
+
post_install_message:
|
|
70
109
|
rdoc_options: []
|
|
71
110
|
require_paths:
|
|
72
111
|
- lib
|
|
@@ -81,9 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
81
120
|
- !ruby/object:Gem::Version
|
|
82
121
|
version: '0'
|
|
83
122
|
requirements: []
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
signing_key:
|
|
123
|
+
rubygems_version: 3.2.19
|
|
124
|
+
signing_key:
|
|
87
125
|
specification_version: 4
|
|
88
126
|
summary: Revamped File.expand_path for Windows
|
|
89
127
|
test_files:
|
metadata.gz.sig
ADDED
|
Binary file
|
data/CHANGES
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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
DELETED
data/README
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
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/futzing/futz.rb
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
require 'win32/xpath'
|
|
2
|
-
require 'tmpdir'
|
|
3
|
-
|
|
4
|
-
#p File.expand_path("~djberge", "foo")
|
|
5
|
-
#p File.expand_path("~/foo")
|
|
6
|
-
#p File.expand_path("", "~djberge")
|
|
7
|
-
#p File.expand_path("~djberge")
|
|
8
|
-
#p File.expand_path("~djberge/foo/bar")
|
|
9
|
-
#p File.expand_path("~bogus")
|
|
10
|
-
|
|
11
|
-
ENV['HOME'] = nil
|
|
12
|
-
ENV['USERPROFILE'] = nil
|
|
13
|
-
ENV['HOMEDRIVE'] = "D:/"
|
|
14
|
-
#ENV['USERPROFILE'] = "C:/bogus"
|
|
15
|
-
p File.expand_path("~")
|
|
16
|
-
|
|
17
|
-
#p File.expand_path("foo", "~")
|
|
18
|
-
#p File.expand_path("foo", "~")
|
|
19
|
-
#p File.expand_path("", "~")
|
|
20
|
-
#p File.expand_path("", "~")
|
|
21
|
-
#p File.expand_path("foo", "~/bar")
|
|
22
|
-
#p File.expand_path("foo", "~/bar")
|
|
23
|
-
#p File.expand_path("")
|
|
24
|
-
#p File.expand_path("C:/foo/bar")
|
|
25
|
-
#p File.expand_path("C:/foo/bar///")
|
|
26
|
-
#p File.expand_path('foo', Dir.tmpdir)
|
|
27
|
-
#p File.expand_path("C:/foo/bar", "D:/foo")
|
|
28
|
-
#p File.expand_path("foo")
|
|
29
|
-
#p File.expand_path("foo", "bar")
|
|
30
|
-
|
|
31
|
-
#ENV['HOME'] = nil
|
|
32
|
-
#ENV['USERPROFILE'] = nil
|
|
33
|
-
#p File.expand_path("~")
|
|
34
|
-
|
|
35
|
-
#path = "../a"
|
|
36
|
-
#tmp = Dir.tmpdir
|
|
37
|
-
|
|
38
|
-
#p path
|
|
39
|
-
#p tmp
|
|
40
|
-
|
|
41
|
-
#100.times{
|
|
42
|
-
# File.expand_path(path, tmp)
|
|
43
|
-
# File.expand_path('foo', tmp)
|
|
44
|
-
#}
|
|
45
|
-
|
|
46
|
-
#p path
|
|
47
|
-
#p tmp
|
|
48
|
-
|
|
49
|
-
#p File.expand_path('../a', tmp)
|
|
50
|
-
|
|
51
|
-
#p File.expand_path('../a', 'foo')
|
|
52
|
-
#p File.expand_path('../a', 'foo')
|
|
53
|
-
#p File.expand_path('../a', 'C:/foo')
|
|
54
|
-
#p File.expand_path('../a', 'C:/foo')
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
=begin
|
|
58
|
-
p File.expand_path("/foo").tainted?
|
|
59
|
-
p File.expand_path("foo").tainted? # True
|
|
60
|
-
p File.expand_path("foo".taint).tainted? # True
|
|
61
|
-
p File.expand_path("C:/foo").tainted? # False
|
|
62
|
-
p File.expand_path("C:/foo".taint).tainted? # True
|
|
63
|
-
=end
|
|
64
|
-
|
|
65
|
-
=begin
|
|
66
|
-
p File.expand_path("~")
|
|
67
|
-
p File.expand_path("~/foo")
|
|
68
|
-
p File.expand_path("//foo/bar")
|
|
69
|
-
p File.expand_path("//foo/bar//")
|
|
70
|
-
p File.expand_path("//foo/bar//")
|
|
71
|
-
=end
|
data/futzing/test.rb
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
require 'ffi'
|
|
2
|
-
|
|
3
|
-
class Windows
|
|
4
|
-
extend FFI::Library
|
|
5
|
-
typedef :ulong, :dword
|
|
6
|
-
|
|
7
|
-
ffi_lib :shlwapi
|
|
8
|
-
|
|
9
|
-
attach_function :PathCanonicalizeA, [:buffer_out, :string], :bool
|
|
10
|
-
attach_function :PathStripToRootA, [:pointer], :bool
|
|
11
|
-
attach_function :PathIsRelativeA, [:string], :bool
|
|
12
|
-
attach_function :PathAppendA, [:buffer_out, :string], :bool
|
|
13
|
-
attach_function :PathSkipRootA, [:string], :string
|
|
14
|
-
attach_function :PathIsNetworkPathA, [:string], :bool
|
|
15
|
-
|
|
16
|
-
ffi_lib :kernel32
|
|
17
|
-
attach_function :GetFullPathNameA, [:string, :dword, :buffer_out, :pointer], :dword
|
|
18
|
-
|
|
19
|
-
def xpath(path, dir=nil)
|
|
20
|
-
path = path.tr("/", "\\")
|
|
21
|
-
|
|
22
|
-
buf = 0.chr * 512
|
|
23
|
-
|
|
24
|
-
p path
|
|
25
|
-
p PathIsRelativeA(path)
|
|
26
|
-
|
|
27
|
-
if !PathCanonicalizeA(buf, path)
|
|
28
|
-
raise
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
p buf.strip
|
|
32
|
-
|
|
33
|
-
#p dir
|
|
34
|
-
#p path
|
|
35
|
-
|
|
36
|
-
#regex = /\A(\w):([^\\]+)(.*)/i
|
|
37
|
-
=begin
|
|
38
|
-
if m = regex.match(path)
|
|
39
|
-
drive = m.captures[0]
|
|
40
|
-
path = m.captures[1..-1].join
|
|
41
|
-
p drive
|
|
42
|
-
p path
|
|
43
|
-
end
|
|
44
|
-
=end
|
|
45
|
-
|
|
46
|
-
#p PathIsNetworkPathA(path)
|
|
47
|
-
#p PathSkipRootA(path)
|
|
48
|
-
#p PathIsRelativeA(path)
|
|
49
|
-
|
|
50
|
-
=begin
|
|
51
|
-
buf = 0.chr * 1024
|
|
52
|
-
|
|
53
|
-
if GetFullPathNameA(path, buf.size, buf, nil) == 0
|
|
54
|
-
raise SystemCallError.new('GetFullPathName', FFI.errno)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
p buf.strip
|
|
58
|
-
=end
|
|
59
|
-
|
|
60
|
-
=begin
|
|
61
|
-
ptr = FFI::MemoryPointer.from_string(path)
|
|
62
|
-
|
|
63
|
-
p PathIsRelativeA(path)
|
|
64
|
-
|
|
65
|
-
unless PathStripToRootA(ptr)
|
|
66
|
-
raise SystemCallError.new('PathStripToRoot', FFI.errno)
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
p ptr.read_string
|
|
70
|
-
=end
|
|
71
|
-
|
|
72
|
-
=begin
|
|
73
|
-
unless PathCanonicalizeA(buf, path)
|
|
74
|
-
raise SystemCallError.new('PathCanonicalize', FFI.errno)
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
buf.strip
|
|
78
|
-
=end
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
if $0 == __FILE__
|
|
83
|
-
Windows.new.xpath("/../../a", "foo")
|
|
84
|
-
#p Windows.new.xpath("C:/foo/../bar")
|
|
85
|
-
#p Windows.new.xpath("C:foo")
|
|
86
|
-
#Windows.new.xpath("C:foo")
|
|
87
|
-
#Windows.new.xpath("C:foo/bar")
|
|
88
|
-
#Windows.new.xpath("C:/foo")
|
|
89
|
-
#Windows.new.xpath("foo")
|
|
90
|
-
end
|