#include "UnixExecutablePathValidator.h"

using namespace clt::filesystem::entities;
using namespace clt::filesystem::entities::validators;

bool
UnixExecutablePathValidator::isPathValid(const Path& path, std::vector<ValidatorBrokenRules> & brokenRules) const {
//TODO: must be a file with executable right
	return path.exists()
		&& !path.isDirectory()
		&& path.isExecutable();
}
#include "UnixExecutablePathValidator.h"

using namespace clt::filesystem::entities;
using namespace clt::filesystem::entities::validators;

bool
UnixExecutablePathValidator::isPathValid(const Path& path, std::vector<ValidatorBrokenRules> & brokenRules) const {
	if (!path.exists()) {
		brokenRules.push_back(ValidatorBrokenRules("Path does not exist"));
		return false;
	}

	if (path.isDirectory()) {
		brokenRules.push_back(ValidatorBrokenRules("The path is not a file"));
		return false;
	}

	if (!path.isExecutable()) {
		brokenRules.push_back(ValidatorBrokenRules("File at path is not executable"));
		return false;
	}

	return true;
}
Add exception management on Unix
Add exception management on Unix
