/*
- suPHP - (c)2002-2005 Sebastian Marsching <sebastian@marsching.com>
+ suPHP - (c)2002-2008 Sebastian Marsching <sebastian@marsching.com>
This file is part of suPHP.
return this->path;
}
-SmartPtr<std::ifstream> suPHP::File::getInputStream() throw (IOException) {
+SmartPtr<std::ifstream> suPHP::File::getInputStream() const throw (IOException) {
std::ifstream* infile = new std::ifstream();
infile->open(this->path.c_str());
if (infile->bad() || infile->fail()) {
- throw IOException("Could not open file " +
- this->path + " for reading", __FILE__, __LINE__);
+ throw IOException("Could not open file " +
+ this->path + " for reading", __FILE__, __LINE__);
}
return SmartPtr<std::ifstream>(infile);
}
File suPHP::File::getParentDirectory() const {
std::string path = this->getPath();
path = path.substr(0, path.rfind('/'));
+ if (path.length() == 0) {
+ path = "/";
+ }
return File(path);
}
GroupInfo suPHP::File::getGroup() const throw (SystemException) {
return API_Helper::getSystemAPI().File_getGroup(*this);
}
+
+
+bool suPHP::File::isSymlink() const throw (SystemException) {
+ return API_Helper::getSystemAPI().File_isSymlink(*this);
+}