Encapsulate OS-specific functions to manipulate file and directory paths. More...
Functions | |
std::string | Append (std::string left, std::string right) |
std::string | Dirname (std::string path) |
std::string | FindSelfDirectory (void) |
std::string | Join (std::list< std::string >::const_iterator begin, std::list< std::string >::const_iterator end) |
void | MakeDirectories (std::string path) |
std::string | MakeTemporaryDirectoryName (void) |
std::list< std::string > | ReadFiles (std::string path) |
std::list< std::string > | Split (std::string path) |
Encapsulate OS-specific functions to manipulate file and directory paths.
The functions provided here are used mostly to implement the ns-3 test framework.
std::string ns3::SystemPath::Append | ( | std::string | left, |
std::string | right | ||
) |
left | a path element |
right | a path element |
Definition at line 163 of file system-path.cc.
References NS_LOG_FUNCTION, and SYSTEM_PATH_SEP.
Referenced by ns3::TestCase::CreateDataDirFilename(), and ns3::TestCase::CreateTempDirFilename().
std::string ns3::SystemPath::Dirname | ( | std::string | path | ) |
Definition at line 64 of file system-path.cc.
References Join(), NS_LOG_FUNCTION, and Split().
Referenced by FindSelfDirectory().
std::string ns3::SystemPath::FindSelfDirectory | ( | void | ) |
This function returns the path to the running $PREFIX. Mac OS X: _NSGetExecutablePath() (man 3 dyld) Linux: readlink /proc/self/exe Solaris: getexecname() FreeBSD: sysctl CTL_KERN KERN_PROC KERN_PROC_PATHNAME -1 BSD with procfs: readlink /proc/curproc/file Windows: GetModuleFileName() with hModule = NULL
Definition at line 73 of file system-path.cc.
References Dirname(), NS_ASSERT, NS_FATAL_ERROR, and NS_LOG_FUNCTION_NOARGS.
Referenced by ns3::TestRunnerImpl::GetTopLevelSourceDir().
std::string ns3::SystemPath::Join | ( | std::list< std::string >::const_iterator | begin, |
std::list< std::string >::const_iterator | end | ||
) |
begin | iterator to first element to join |
end | iterator to last element to join |
Definition at line 198 of file system-path.cc.
References NS_LOG_FUNCTION, and SYSTEM_PATH_SEP.
Referenced by ns3::TestCase::CreateTempDirFilename(), Dirname(), ns3::TestRunnerImpl::GetTopLevelSourceDir(), and MakeDirectories().
void ns3::SystemPath::MakeDirectories | ( | std::string | path | ) |
path | a path to a directory |
Create all the directories leading to path.
Definition at line 303 of file system-path.cc.
References Join(), NS_LOG_ERROR, NS_LOG_FUNCTION, and Split().
Referenced by ns3::TestCase::CreateTempDirFilename().
std::string ns3::SystemPath::MakeTemporaryDirectoryName | ( | void | ) |
The returned path identifies a directory which does not exist yet Call ns3::SystemPath::MakeDirectories to create it. Yes, there is a well-known security race in this API but we don't care in ns-3.
Definition at line 256 of file system-path.cc.
References NS_LOG_FUNCTION_NOARGS, and SYSTEM_PATH_SEP.
Referenced by ns3::TestRunnerImpl::Run().
std::list< std::string > ns3::SystemPath::ReadFiles | ( | std::string | path | ) |
path | a path which identifies a directory |
Definition at line 217 of file system-path.cc.
References NS_FATAL_ERROR, and NS_LOG_FUNCTION.
Referenced by ns3::TestRunnerImpl::IsTopLevelSourceDir().
std::list< std::string > ns3::SystemPath::Split | ( | std::string | path | ) |
path | a path |
Definition at line 180 of file system-path.cc.
References current, NS_LOG_FUNCTION, and SYSTEM_PATH_SEP.
Referenced by Dirname(), ns3::TestRunnerImpl::GetTopLevelSourceDir(), MakeDirectories(), and ns3::CommandLine::Parse().