Changeset 2534 for code/branches/buildsystem2/src/util
- Timestamp:
- Dec 28, 2008, 7:12:44 PM (16 years ago)
- Location:
- code/branches/buildsystem2/src/util
- Files:
-
- 2 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 } -
code/branches/buildsystem2/src/util/String.h
r2509 r2534 81 81 } 82 82 83 _UtilExport void convertToWindowsPath(std::string* str);84 _UtilExport void convertToUnixPath(std::string* str);85 86 83 #endif /* _Util_String_H__ */
Note: See TracChangeset
for help on using the changeset viewer.