From ba07e6c6d7280bda93e31f18ccbe004576ca038d Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Mon, 13 Jun 2022 08:08:43 -0400 Subject: [PATCH] * Cleanup: Remove the partial editor tools integration from the TORQUE_SECURE_VFS implementation in preference for developers building mod tools builds instead. --- .../source/windowManager/sdl/sdlWindowMgr.cpp | 82 ------------------- .../source/windowManager/sdl/sdlWindowMgr.h | 21 ----- 2 files changed, 103 deletions(-) diff --git a/Engine/source/windowManager/sdl/sdlWindowMgr.cpp b/Engine/source/windowManager/sdl/sdlWindowMgr.cpp index 68def351a..dad0686d9 100644 --- a/Engine/source/windowManager/sdl/sdlWindowMgr.cpp +++ b/Engine/source/windowManager/sdl/sdlWindowMgr.cpp @@ -37,25 +37,6 @@ void sdl_CloseSplashWindow(void* hinst); #ifdef TORQUE_SDL -#ifdef TORQUE_SECURE_VFS -PlatformWindowManagerSDL::DragAndDropFSInfo::DragAndDropFSInfo() -{ -} - -PlatformWindowManagerSDL::DragAndDropFSInfo::DragAndDropFSInfo(String rootName, Torque::FS::FileSystemRef fileSystem) : mRootName(rootName), mDragAndDropFS(fileSystem) -{ - if (!Torque::FS::Mount(rootName, fileSystem)) - { - Con::errorf("Could not mount drag and drop FS!"); - } -} - -PlatformWindowManagerSDL::DragAndDropFSInfo::~DragAndDropFSInfo() -{ - -} -#endif - PlatformWindowManager * CreatePlatformWindowManager() { return new PlatformWindowManagerSDL(); @@ -87,15 +68,6 @@ PlatformWindowManagerSDL::PlatformWindowManagerSDL() PlatformWindowManagerSDL::~PlatformWindowManagerSDL() { - // Unmount all drag and drop FS mounts - for (auto iteration = mActiveDragAndDropFSByPath.begin(); iteration != mActiveDragAndDropFSByPath.end(); ++iteration) - { - auto&& mapping = *iteration; - Torque::FS::Unmount(mapping.value.mDragAndDropFS); - } - mActiveDragAndDropByRoot.clear(); - mActiveDragAndDropFSByPath.clear(); - // Kill all our windows first. while(mWindowListHead) // The destructors update the list, so this works just fine. @@ -457,61 +429,7 @@ void PlatformWindowManagerSDL::_process() if (!Platform::isDirectory(fileName) && !Platform::isFile(fileName)) break; -#ifdef TORQUE_SECURE_VFS - // Determine what the directory is so we can mount it - Torque::Path targetDirectory = Torque::Path(fileName); - - // If we're dropping a file, strip off file information - otherwise if a directory mount it directly - if (Platform::isFile(fileName)) - { - targetDirectory.setExtension(""); - targetDirectory.setFileName(""); - } - const String directoryName = targetDirectory.getDirectory(targetDirectory.getDirectoryCount() - 1); - - auto dropFSMount = mActiveDragAndDropFSByPath.find(targetDirectory); - if (dropFSMount == mActiveDragAndDropFSByPath.end()) - { - Torque::FS::FileSystemRef newMount = Platform::FS::createNativeFS(targetDirectory.getFullPath()); - - // Search for an unused root in case we have duplicate names - U32 rootCounter = 1; - String chosenRootName = directoryName; - auto search = mActiveDragAndDropByRoot.find(chosenRootName); - while (search != mActiveDragAndDropByRoot.end()) - { - char buffer[32]; - dSprintf(buffer, sizeof(buffer), "%u", rootCounter); - chosenRootName = directoryName + buffer; - - search = mActiveDragAndDropByRoot.find(chosenRootName); - } - - mActiveDragAndDropFSByPath[targetDirectory] = DragAndDropFSInfo(directoryName, newMount); - mActiveDragAndDropFSByPath[chosenRootName] = mActiveDragAndDropFSByPath[targetDirectory]; - } - - DragAndDropFSInfo& filesystemInformation = mActiveDragAndDropFSByPath[targetDirectory]; - - // Load source file information - Torque::Path sourceFile = fileName; - - // Build a reference to the file in VFS - Torque::Path targetFile; - targetFile.setRoot(filesystemInformation.mRootName); - targetFile.setPath("/"); - - // Only copy file & extension information if we're dropping a file - if (Platform::isFile(fileName)) - { - targetFile.setFileName(sourceFile.getFileName()); - targetFile.setExtension(sourceFile.getExtension()); - } - - Con::executef("onDropFile", StringTable->insert(targetFile.getFullPath())); -#else Con::executef("onDropFile", StringTable->insert(fileName)); -#endif SDL_free(fileName); // Free dropped_filedir memory break; diff --git a/Engine/source/windowManager/sdl/sdlWindowMgr.h b/Engine/source/windowManager/sdl/sdlWindowMgr.h index fc2ae4969..45cd3bfe3 100644 --- a/Engine/source/windowManager/sdl/sdlWindowMgr.h +++ b/Engine/source/windowManager/sdl/sdlWindowMgr.h @@ -27,7 +27,6 @@ #include "gfx/gfxStructs.h" #include "windowManager/sdl/sdlWindow.h" #include "core/util/tVector.h" -#include "core/volume.h" struct SDL_Window; class FileDialog; // TODO SDL REMOVE @@ -58,18 +57,6 @@ public: RAW_INPUT = 2 /// < We only want raw input. }; -#ifdef TORQUE_SECURE_VFS - struct DragAndDropFSInfo - { - String mRootName; - Torque::FS::FileSystemRef mDragAndDropFS; - - DragAndDropFSInfo(); - DragAndDropFSInfo(String rootName, Torque::FS::FileSystemRef fileSystem); - ~DragAndDropFSInfo(); - }; -#endif - protected: friend class PlatformWindowSDL; friend class FileDialog; // TODO SDL REMOVE @@ -110,14 +97,6 @@ protected: /// After it is handled, it will return to state NONE. KeyboardInputState mInputState; -#ifdef TORQUE_SECURE_VFS - /// Used to check if a root is already used when generating root names. - HashMap mActiveDragAndDropByRoot; - - /// Used to keep track of what mounts are handling a given path. - HashMap mActiveDragAndDropFSByPath; -#endif - public: PlatformWindowManagerSDL(); ~PlatformWindowManagerSDL();