Files::iterator
Files::findAbsolutePath(const string& filename)
{
- if (!boost::starts_with(filename, getSnapper()->subvolumeDir()))
+ string subvolume = getSnapper()->subvolumeDir();
+
+ if (!boost::starts_with(filename, subvolume))
return end();
- return find(string(filename, getSnapper()->subvolumeDir().size()));
+ if (subvolume == "/")
+ return find(filename);
+ else
+ return find(string(filename, subvolume.size()));
}
Files::const_iterator
Files::findAbsolutePath(const string& filename) const
{
- if (!boost::starts_with(filename, getSnapper()->subvolumeDir()))
+ string subvolume = getSnapper()->subvolumeDir();
+
+ if (!boost::starts_with(filename, subvolume))
return end();
- return find(string(filename, getSnapper()->subvolumeDir().size()));
+ if (subvolume == "/")
+ return find(filename);
+ else
+ return find(string(filename, subvolume.size()));
}
string
Btrfs::infosDir() const
{
- return subvolume + "/.snapshots";
+ return (subvolume == "/" ? "" : subvolume) + "/.snapshots";
}
string
Btrfs::snapshotDir(unsigned int num) const
{
- return subvolume + "/.snapshots/" + decString(num) + "/snapshot";
+ return (subvolume == "/" ? "" : subvolume) + "/.snapshots/" +
+ decString(num) + "/snapshot";
}
string
Ext4::infosDir() const
{
- return subvolume + "/.snapshots/.info";
+ return (subvolume == "/" ? "" : subvolume) + "/.snapshots/.info";
}
string
Ext4::snapshotFile(unsigned int num) const
{
- return subvolume + "/.snapshots/" + decString(num);
+ return (subvolume == "/" ? "" : subvolume) + "/.snapshots/" + decString(num);
}