Browse Source

Merge pull request #2956 from RytoEX/fix-GetUnusedSceneCollectionFile

UI: Fix GetUnusedSceneCollectionFile filename creation
Jim 5 years ago
parent
commit
b6375a2a68
1 changed files with 1 additions and 3 deletions
  1. 1 3
      UI/window-basic-main-scene-collections.cpp

+ 1 - 3
UI/window-basic-main-scene-collections.cpp

@@ -92,7 +92,6 @@ static bool SceneCollectionExists(const char *findName)
 static bool GetUnusedSceneCollectionFile(std::string &name, std::string &file)
 {
 	char path[512];
-	size_t len;
 	int ret;
 
 	if (!GetFileSafeName(name.c_str(), file)) {
@@ -107,7 +106,6 @@ static bool GetUnusedSceneCollectionFile(std::string &name, std::string &file)
 		return false;
 	}
 
-	len = file.size();
 	file.insert(0, path);
 
 	if (!GetClosestUnusedFileName(file, "json")) {
@@ -117,7 +115,7 @@ static bool GetUnusedSceneCollectionFile(std::string &name, std::string &file)
 	}
 
 	file.erase(file.size() - 5, 5);
-	file.erase(0, file.size() - len);
+	file.erase(0, strlen(path));
 	return true;
 }