28 #define access _access
50 if (path.length() == 0) {
53 while (path[path.length() - 1] ==
'/' || path[path.length() - 1] ==
'\\') {
54 path.erase(path.end() - 1);
56 if (path.length() == 0) {
59 return access(path.c_str(), R_OK) == 0;
65 if (stat(path.c_str(), &fileInfo) != 0) {
66 throw ProcessError(
"Cannot get file attributes for file '" + path +
"'!");
68 return (fileInfo.st_mode & S_IFMT) == S_IFDIR;
77 const std::string::size_type beg = path.find_last_of(
"\\/");
78 if (beg == std::string::npos) {
81 return path.substr(0, beg + 1);
89 }
else if (extension.empty()) {
91 }
else if (path == extension) {
93 }
else if (path.size() < extension.size()) {
94 return path + extension;
97 std::string::const_reverse_iterator it_path = path.rbegin();
98 std::string::const_reverse_iterator it_extension = extension.rbegin();
100 while (it_extension != extension.rend()) {
102 if (*it_path != *it_extension) {
103 return path + extension;
117 return retPath + path;
123 const std::string::size_type colonPos = name.find(
":");
124 return (colonPos != std::string::npos) && (colonPos > 1);
134 if (path.length() > 0 && path[0] ==
'/') {
138 if (path.length() > 0 && path[0] ==
'\\') {
141 if (path.length() > 1 && path[1] ==
':') {
144 if (path ==
"nul" || path ==
"NUL") {
153 if (filename ==
"stdout" || filename ==
"STDOUT" || filename ==
"-") {
156 if (filename ==
"stderr" || filename ==
"STDERR") {
159 if (filename ==
"nul" || filename ==
"NUL") {
171 const std::string::size_type sep_index = path.find_last_of(
"\\/");
172 if (sep_index == std::string::npos) {
173 return prefix + path;
175 return path.substr(0, sep_index + 1) + prefix + path.substr(sep_index + 1);
185 strm.write((
char*) &value,
sizeof(
int));
192 strm.write((
char*) &value,
sizeof(
double));
199 strm.write((
char*) &value,
sizeof(
char));
206 int size = (int)value.length();
207 const char* cstr = value.c_str();
209 strm.write((
char*) cstr, (std::streamsize)(
sizeof(
char)*size));
216 strm.write((
char*) &value,
sizeof(
SUMOTime));