summaryrefslogtreecommitdiff
path: root/types/compat/absolute_path.pp
diff options
context:
space:
mode:
Diffstat (limited to 'types/compat/absolute_path.pp')
-rw-r--r--types/compat/absolute_path.pp7
1 files changed, 7 insertions, 0 deletions
diff --git a/types/compat/absolute_path.pp b/types/compat/absolute_path.pp
new file mode 100644
index 0000000..d11784e
--- /dev/null
+++ b/types/compat/absolute_path.pp
@@ -0,0 +1,7 @@
+# Emulate the is_absolute_path and validate_absolute_path functions
+#
+# 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?
+# slash = '[\\\\/]'
+# name = '[^\\\\/]+'
+# %r!^(([A-Z]:#{slash})|(#{slash}#{slash}#{name}#{slash}#{name})|(#{slash}#{slash}\?#{slash}#{name}))!i,
+type Stdlib::Compat::Absolute_path = Variant[Pattern[/^(([a-zA-Z]:[\\\/])|([\\\/][\\\/][^\\\/]+[\\\/][^\\\/]+)|([\\\/][\\\/]\?[\\\/][^\\\/]+))/], Pattern[/^\//]]