|
@@ -136,21 +136,23 @@ std::string FileMan::pathToFilename(std::string path) {
|
|
|
|
|
|
int lastFoundIndex = -1;
|
|
|
|
|
|
- for (int currentIndex = name.find("/"); currentIndex != string::npos;
|
|
|
- currentIndex = name.find("/", currentIndex + 1)) {
|
|
|
+ for (int currentIndex = path.find("/"); currentIndex != std::string::npos;
|
|
|
+ currentIndex = path.find("/", currentIndex + 1)) {
|
|
|
|
|
|
// check if the "/" was escaped
|
|
|
- if (currentIndex > 0 && cmd[currentIndex - 1] = '\\')
|
|
|
+ if (currentIndex > 0 && path[currentIndex - 1] == '\\')
|
|
|
continue;
|
|
|
|
|
|
+/* // check unnecessary, because error occurs when trying to open file anyways
|
|
|
+
|
|
|
// check if the "/" is at the end of path name
|
|
|
- if (currentIndex + 1 == name.length) {
|
|
|
+ if (currentIndex + 1 == path.length()) {
|
|
|
// ERROR: INVALID FILENAME, BECAUSE ENDS WITH "/"
|
|
|
}
|
|
|
-
|
|
|
+*/
|
|
|
// otherwise we found a valid "/"
|
|
|
lastFoundIndex = currentIndex;
|
|
|
}
|
|
|
|
|
|
- return name.substr(lastFoundIndex + 1);
|
|
|
+ return path.substr(lastFoundIndex + 1);
|
|
|
}
|