Skip to content

Commit f95d159

Browse files
author
Domenic Del Nano
committed
Add types/
1 parent 2c629c6 commit f95d159

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

types/absolutepath.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# A strict absolutepath type
2+
type Stdlib::Absolutepath = Variant[Stdlib::Windowspath, Stdlib::Unixpath]

types/compat/absolute_path.pp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Emulate the is_absolute_path and validate_absolute_path functions
2+
#
3+
# The first pattern is originally from is_absolute_path, which had it from 2.7.x's lib/puppet/util.rb Puppet::Util.absolute_path?
4+
# slash = '[\\\\/]'
5+
# name = '[^\\\\/]+'
6+
# %r!^(([A-Z]:#{slash})|(#{slash}#{slash}#{name}#{slash}#{name})|(#{slash}#{slash}\?#{slash}#{name}))!i,
7+
type Stdlib::Compat::Absolute_path = Variant[Pattern[/^(([a-zA-Z]:[\\\/])|([\\\/][\\\/][^\\\/]+[\\\/][^\\\/]+)|([\\\/][\\\/]\?[\\\/][^\\\/]+))/], Pattern[/^\//]]

0 commit comments

Comments
 (0)