36 #define access _access
45 #ifdef CHECK_MEMORY_LEAKS
47 #endif // CHECK_MEMORY_LEAKS
58 if (path.length() == 0) {
61 while (path[path.length() - 1] ==
'/' || path[path.length() - 1] ==
'\\') {
62 path.erase(path.end() - 1);
64 if (path.length() == 0) {
67 return access(path.c_str(), 0) != -1;
76 size_t beg = path.find_last_of(
"\\/");
77 if (beg == std::string::npos || beg == 0) {
80 return path.substr(0, beg + 1);
86 const std::string& path) {
88 return retPath + path;
94 size_t colonPos = name.find(
":");
95 return (colonPos != std::string::npos) && (colonPos > 1);
105 if (path.length() > 0 && path[0] ==
'/') {
109 if (path.length() > 0 && path[0] ==
'\\') {
112 if (path.length() > 1 && path[1] ==
':') {
115 if (path ==
"nul" || path ==
"NUL") {
124 const std::string& basePath) {
125 if (filename ==
"stdout" || filename ==
"STDOUT" || filename ==
"-") {
128 if (filename ==
"stderr" || filename ==
"STDERR") {
143 strm.write((
char*) &value,
sizeof(
int));
150 strm.write((
char*) &value,
sizeof(
unsigned int));
157 strm.write((
char*) &value,
sizeof(
SUMOReal));
164 strm.write((
char*) &value,
sizeof(
char));
171 size_t size = value.length();
172 const char* cstr = value.c_str();
174 strm.write((
char*) cstr, (std::streamsize)(
sizeof(
char)*size));
181 strm.write((
char*) &value,
sizeof(
SUMOTime));
static std::string getConfigurationRelative(const std::string &configPath, const std::string &path)
Returns the second path as a relative path to the first file.
static bool isSocket(const std::string &name)
Returns the information whether the given name represents a socket.
static std::ostream & writeFloat(std::ostream &strm, SUMOReal value)
Writes a float binary.
static std::ostream & writeUInt(std::ostream &strm, unsigned int value)
Writes an unsigned integer binary.
static std::ostream & writeTime(std::ostream &strm, SUMOTime value)
Writes a time description binary.
static bool isAbsolute(const std::string &path)
Returns the information whether the given path is absolute.
static bool exists(std::string path)
Checks whether the given file exists.
static std::ostream & writeInt(std::ostream &strm, int value)
Writes an integer binary.
static std::ostream & writeByte(std::ostream &strm, unsigned char value)
Writes a byte binary.
static std::string checkForRelativity(const std::string &filename, const std::string &basePath)
Returns the path from a configuration so that it is accessable from the current working directory...
static std::string getFilePath(const std::string &path)
Removes the file information from the given path.
static std::ostream & writeString(std::ostream &strm, const std::string &value)
Writes a string binary.