Path::strip_last_element removes path delimiter

Remove the trailing slash of a path where the path is not "/".
New Path::append_element convenience function.

Fixes #1744
This commit is contained in:
Emery Hemingway
2016-05-12 12:50:16 +02:00
committed by Christian Helmuth
parent 8b78001858
commit 0a01edded2
4 changed files with 20 additions and 16 deletions

View File

@ -4,6 +4,13 @@
* \date 2012-04-11
*/
/*
* Copyright (C) 2012-2016 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _FILE_SYSTEM__UTIL_H_
#define _FILE_SYSTEM__UTIL_H_
@ -89,7 +96,6 @@ namespace File_system {
} catch (Lookup_failed) {
Genode::Path<MAX_PATH_LEN> target(path);
target.strip_last_element();
target.remove_trailing('/');
fs.close(ensure_dir(fs, target.base()));
}
}