Skip to content

Commit 5379721

Browse files
committed
Fixing windows related path issues
1 parent 506057a commit 5379721

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

.travis.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,31 @@
11
language: php
22

3-
php:
4-
- '7.1'
5-
- '7.2'
6-
- '7.3'
7-
- nightly
8-
93
matrix:
4+
include:
5+
# linux tests
6+
- php: '7.1'
7+
- php: '7.2'
8+
- php: '7.3'
9+
- php: nightly
10+
# windows tests
11+
# https://travis-ci.community/t/where-to-contribute-php-support-for-windows/304
12+
- os: windows
13+
language: sh
14+
before_install:
15+
- export PATH="/c/tools/composer:/c/tools/php73:$PATH"
16+
- echo "$PATH"
17+
- choco install php --version 7.3.5
18+
- php -i
19+
- cat /c/tools/php73/php.ini
20+
#- choco install make
21+
- ls /c/tools/php73
22+
- ls /c/tools/php73/ext
23+
#- ls /c/tools/composer
24+
- wget https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer -O - -q | php -dextension=/c/tools/php73/ext/php_openssl.dll --
25+
- ls
26+
install: php -dextension=/c/tools/php73/ext/php_openssl.dll -dextension=/c/tools/php73/ext/php_mbstring.dll composer.phar install --prefer-dist --no-interaction
27+
script: php -dextension=/c/tools/php73/ext/php_openssl.dll -dextension=/c/tools/php73/ext/php_mbstring.dll vendor/phpunit/phpunit/phpunit
28+
1029
# allow php nightly to fail until https://travis-ci.community/t/php-nightly-now-requires-oniguruma/2237 is fixed
1130
allow_failures:
1231
- php: nightly

src/ReferenceContext.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ public function resolveRelativeUri(string $uri): string
8888
// absolute path
8989
return 'file://' . $parts['path'];
9090
}
91+
// convert absolute path on windows to a file:// URI. This is probably incomplete but should work with the majority of paths.
92+
if (stripos(PHP_OS, 'WIN') === 0 && strncmp(substr($uri, 1), ':\\', 2) === 0) {
93+
return "file:///" . strtr($uri, [' ' => '%20', '\\' => '/']);
94+
}
95+
9196
if (isset($parts['path'])) {
9297
// relative path
9398
return dirname($baseUri) . '/' . $parts['path'];

0 commit comments

Comments
 (0)