ensure paths end in '/'. fixes launchpad bug 184905

git-svn-id: http://encfs.googlecode.com/svn/trunk@9 db9cf616-1c43-0410-9cb8-a902689de0d6
This commit is contained in:
Valient Gough 2008-01-23 05:31:20 +00:00
parent 72625ab441
commit 8c2546510a

View File

@ -413,9 +413,22 @@ static int copyContents(const shared_ptr<EncFS_Root> &rootInfo,
return EXIT_SUCCESS;
}
static bool endsWith(const string &str, char ch)
{
if(str.empty())
return false;
else
return str[str.length()-1] == ch;
}
static int traverseDirs(const shared_ptr<EncFS_Root> &rootInfo,
string volumeDir, string destDir)
{
if(!endsWith(volumeDir, '/'))
volumeDir.append("/");
if(!endsWith(destDir, '/'))
destDir.append("/");
// Lookup directory node so we can create a destination directory
// with the same permissions
{