Changeset 2534 for code/branches/buildsystem2/src/util/String.cc
- Timestamp:
- Dec 28, 2008, 7:12:44 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/buildsystem2/src/util/String.cc
r2509 r2534 493 493 } 494 494 } 495 496 /**497 @brief Converts a path string to windows with "\" instead of "/".498 @param str String pointer to be manipulated499 */500 void convertToWindowsPath(std::string* str)501 {502 std::string& path = *str;503 // replace all occurences of "/" with "\"504 for (unsigned int i = 0; i < path.length(); ++i)505 {506 if (path[i] == '/')507 path[i] = '\\';508 }509 // add an extra '\\' at the end to make it a complete path510 if (path != "" && path[path.length() - 1] != '\\')511 path.append("\\");512 }513 514 /**515 @brief Converts a path string to unix with "/" instead of "\".516 @param str String pointer to be manipulated517 */518 void convertToUnixPath(std::string* str)519 {520 std::string& path = *str;521 // replace all occurences of "\" with "/"522 for (unsigned int i = 0; i < path.length(); ++i)523 {524 if (path[i] == '\\')525 path[i] = '/';526 }527 // add an extra '\\' at the end to make it a complete path528 if (path != "" && path[path.length() - 1] != '/')529 path.append("/");530 }
Note: See TracChangeset
for help on using the changeset viewer.