virtual const char* what() const throw() { return "IO error"; }
};
+ struct ProgramNotInstalledException : public SnapperException
+ {
+ explicit ProgramNotInstalledException(const char* msg) throw() : msg(msg) {}
+ virtual const char* what() const throw() { return msg; }
+ const char* msg;
+ };
+
}
}
+ Btrfs::Btrfs(const string& subvolume)
+ : Filesystem(subvolume)
+ {
+ if (access(BTRFSBIN, X_OK) != 0)
+ {
+ throw ProgramNotInstalledException(BTRFSBIN " not installed");
+ }
+ }
+
+
void
Btrfs::addConfig() const
{
}
+ Ext4::Ext4(const string& subvolume)
+ : Filesystem(subvolume)
+ {
+ if (access(CHSNAPBIN, X_OK) != 0)
+ {
+ throw ProgramNotInstalledException(CHSNAPBIN " not installed");
+ }
+
+ if (access(CHATTRBIN, X_OK) != 0)
+ {
+ throw ProgramNotInstalledException(CHATTRBIN " not installed");
+ }
+ }
+
+
void
Ext4::addConfig() const
{
{
public:
- Btrfs(const string& subvolume) : Filesystem(subvolume) {}
+ Btrfs(const string& subvolume);
virtual string name() const { return "btrfs"; }
{
public:
- Ext4(const string& subvolume) : Filesystem(subvolume) {}
+ Ext4(const string& subvolume);
virtual string name() const { return "ext4"; }
{
throw AddConfigFailedException("invalid filesystem type");
}
+ catch (const ProgramNotInstalledException& e)
+ {
+ throw AddConfigFailedException(e.what());
+ }
try
{