1 /* xbt_os_file.cpp -- portable interface to file-related functions */
3 /* Copyright (c) 2017-2018. The SimGrid Team. All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
8 #include "src/internal_config.h"
9 #include "xbt/file.hpp" /* this module */
20 #include <libgen.h> /* POSIX dirname */
22 simgrid::xbt::Path::Path()
27 path_ = std::string(buffer);
29 path_ = std::string(".");
33 std::string simgrid::xbt::Path::get_dir_name()
36 char *res = dirname(&p[0]);
37 return std::string(res, strlen(res));
40 std::string simgrid::xbt::Path::get_base_name()
43 char *res = basename(&p[0]);
44 return std::string(res, strlen(res));