# Some shared sub routines
#
# Author: Patrick Canterino <patshaping@gmx.net>
-# Last modified: 2003-10-27
+# Last modified: 2004-02-24
#
use strict;
@EXPORT = qw(check_path
clean_path
devedit_reload
+ equal_url
file_name
upper_path);
my $short_path = substr($path,length($root));
$short_path =~ tr!\\!\/!;
- $short_path = "/".$short_path unless($short_path =~ m!^/!);
+ $short_path = "/".$short_path if($short_path !~ m!^/!);
$short_path = $short_path."/" if($short_path !~ m!/$! && -d $path);
return ($path,$short_path);
return \$header;
}
+# equal_url()
+#
+# Create URL equal to a file or directory
+#
+# Params: 1. HTTP root
+# 2. Relative path
+#
+# Return: Formatted link (String)
+
+sub equal_url($$)
+{
+ my ($root,$path) = @_;
+ my $url;
+
+ $root =~ s!/$!!;
+ $path =~ s!^/!!;
+ $url = $root."/".$path;
+
+ return $url;
+}
+
# file_name()
#
-# Returns the last path of a path
+# Return the last path of a path
#
# Params: Path
#
# upper_path()
#
-# Truncate a path in one of the following ways:
-#
-# - If the path points to a directory, the upper directory
-# will be returned.
-# - If the path points to a file, the directory containing
-# the file will be returned.
+# Cut away the last part of a path
#
# Params: Path
#