From 0e297c178531651238c91bc1e62dcb7dd356e541 Mon Sep 17 00:00:00 2001 From: pcanterino <> Date: Sun, 7 Nov 2004 20:42:19 +0000 Subject: [PATCH 1/1] Check if the root directory exists --- devedit.pl | 6 +++++- errors.dat | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/devedit.pl b/devedit.pl index c29c22e..eccebd0 100644 --- a/devedit.pl +++ b/devedit.pl @@ -6,7 +6,7 @@ # Dev-Editor's main program # # Author: Patrick Canterino -# Last modified: 2004-11-04 +# Last modified: 2004-11-07 # use strict; @@ -35,6 +35,10 @@ use constant CONFIGFILE => 'devedit.dat'; my $config = read_config(CONFIGFILE); error_template($config->{'templates'}->{'error'}); # Yes, I'm lazy... +# Check if the root directory exists + +abort($config->{'errors'}->{'no_root_dir'}) unless(-d $config->{'fileroot'}); + # Check if we are able to access the root directory abort($config->{'errors'}->{'no_root_access'}) unless(-r $config->{'fileroot'} && -x $config->{'fileroot'}); diff --git a/errors.dat b/errors.dat index ffa9c68..c7a170c 100644 --- a/errors.dat +++ b/errors.dat @@ -12,6 +12,7 @@ mkfile_failed = Could not create file '{FILE}'. mkdir_failed = Could not create directory '{DIR}'. copy_failed = Could not copy '{FILE}' to '{NEW_FILE}'. rename_failed = Could not move/rename '{FILE}' to '{NEW_FILE}'. +no_root_dir = The root directory does not exist or is not a directory. no_root_access = You have not enough permissions to access the root directory. above_root = Accessing files and directories above the virtual root directory is forbidden. create_ar = You aren't allowed to create files and directories above the virtual root directory. -- 2.34.1