History

Don't allow folder overwrite

Atlante45 committed 10 years ago

Commit 35f5ebb1 parent 2fb478f3 files · +23 −4Browse files

Showing the changes to interface/src/scripting/AssetMappingsScriptingInterface.cpp (1 of 3 files). Show all

Unified · Split

interface/src/scripting/AssetMappingsScriptingInterface.cpp+13−0
@@ -174,6 +174,19 @@ void AssetMappingsScriptingInterface::renameMapping(QString oldPath, QString new · 173 unmodified lines
174174 request->start();
175175 }
176176
177+bool AssetMappingModel::isKnownFolder(QString path) const {
178+ if (!path.endsWith("/")) {
179+ return false;
180+ }
181+
182+ auto existingPaths = _pathToItemMap.keys();
183+ for (auto& entry : existingPaths) {
184+ if (entry.startsWith(path)) {
185+ return true;
186+ }
187+ }
188+ return false;
189+}
177190
178191 AssetMappingItem::AssetMappingItem(const QString& name, const QString& fullPath, bool isFolder) :
179192 name(name),