Kaynağa Gözat

UI: Prevent name collision during scene collection import

The Scene Collection Importer would attempt to set the new filename
using the name property of the scene collection. However, it would
determine an unused filename, and then replace spaces with underscores,
which could cause a name collision. This changes the importer to replace
spaces with underscores first for the base filename, and then determine
an unused filename.
Ryan Foster 5 yıl önce
ebeveyn
işleme
2d1b0666af
1 değiştirilmiş dosya ile 3 ekleme ve 2 silme
  1. 3 2
      UI/window-importer.cpp

+ 3 - 2
UI/window-importer.cpp

@@ -577,11 +577,12 @@ void OBSImporter::importCollections()
 			json11::Json::object out = res.object_items();
 			QString file = res["name"].string_value().c_str();
 
+			file.replace(" ", "_");
 			bool safe = !CheckConfigExists(dst, file);
 			int x = 1;
 			while (!safe) {
 				file = name;
-				file += " (";
+				file += "_(";
 				file += QString::number(x);
 				file += ")";
 
@@ -593,7 +594,7 @@ void OBSImporter::importCollections()
 
 			std::string save = dst;
 			save += "/";
-			save += file.replace(" ", "_").toStdString();
+			save += file.toStdString();
 			save += ".json";
 
 			std::string out_str = json11::Json(out).dump();