Browse Source

Removed WPath

Marko Pintera 12 years ago
parent
commit
e688c086c8

+ 2 - 3
CamelotClient/Include/BsGUIResourceTreeView.h

@@ -2,7 +2,6 @@
 
 #include "BsEditorPrerequisites.h"
 #include "BsGUITreeView.h"
-#include "CmPath.h"
 #include <boost/signal.hpp>
 
 namespace BansheeEditor
@@ -82,8 +81,8 @@ namespace BansheeEditor
 
 		ResourceTreeElement* findTreeElement(const CM::WString& fullPath);
 
-		void entryAdded(const CM::WPath& path);
-		void entryRemoved(const CM::WPath& path);
+		void entryAdded(const CM::WString& path);
+		void entryRemoved(const CM::WString& path);
 
 		void setDropTarget(CM::RenderWindow* parentWindow, CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height);
 		void clearDropTarget();

+ 14 - 15
CamelotClient/Include/BsProjectLibrary.h

@@ -2,7 +2,6 @@
 
 #include "BsEditorPrerequisites.h"
 #include "CmModule.h"
-#include "CmPath.h"
 
 namespace BansheeEditor
 {
@@ -21,10 +20,10 @@ namespace BansheeEditor
 
 		struct LibraryEntry
 		{
-			LibraryEntry(const CM::WPath& path, const CM::WString& name, DirectoryEntry* parent, LibraryEntryType type);
+			LibraryEntry(const CM::WString& path, const CM::WString& name, DirectoryEntry* parent, LibraryEntryType type);
 
 			LibraryEntryType type;
-			CM::WPath path;
+			CM::WString path;
 			CM::WString elementName;
 
 			DirectoryEntry* parent;
@@ -32,7 +31,7 @@ namespace BansheeEditor
 
 		struct ResourceEntry : public LibraryEntry
 		{
-			ResourceEntry(const CM::WPath& path, const CM::WString& name, DirectoryEntry* parent);
+			ResourceEntry(const CM::WString& path, const CM::WString& name, DirectoryEntry* parent);
 
 			ResourceMetaPtr meta;
 			std::time_t lastUpdateTime;
@@ -40,7 +39,7 @@ namespace BansheeEditor
 
 		struct DirectoryEntry : public LibraryEntry
 		{
-			DirectoryEntry(const CM::WPath& path, const CM::WString& name, DirectoryEntry* parent);
+			DirectoryEntry(const CM::WString& path, const CM::WString& name, DirectoryEntry* parent);
 
 			CM::Vector<LibraryEntry*>::type mChildren;
 		};
@@ -53,32 +52,32 @@ namespace BansheeEditor
 		void checkForModifications(const CM::WString& fullPath);
 
 		const LibraryEntry* getRootEntry() const { return mRootEntry; }
-		LibraryEntry* findEntry(const CM::WPath& fullPath) const;
+		LibraryEntry* findEntry(const CM::WString& fullPath) const;
 
-		void moveEntry(const CM::WPath& oldPath, const CM::WPath& newPath);
-		void deleteEntry(const CM::WPath& path);
+		void moveEntry(const CM::WString& oldPath, const CM::WString& newPath);
+		void deleteEntry(const CM::WString& path);
 
-		boost::signal<void(const CM::WPath&)> onEntryRemoved;
-		boost::signal<void(const CM::WPath&)> onEntryAdded;
+		boost::signal<void(const CM::WString&)> onEntryRemoved;
+		boost::signal<void(const CM::WString&)> onEntryAdded;
 	private:
 		static const CM::WString INTERNAL_RESOURCES_DIR;
 
 		DirectoryEntry* mRootEntry;
 		CM::FolderMonitor* mMonitor;
 
-		ResourceEntry* addResourceInternal(DirectoryEntry* parent, const CM::WPath& filePath);
-		DirectoryEntry* addDirectoryInternal(DirectoryEntry* parent, const CM::WPath& dirPath);
+		ResourceEntry* addResourceInternal(DirectoryEntry* parent, const CM::WString& filePath);
+		DirectoryEntry* addDirectoryInternal(DirectoryEntry* parent, const CM::WString& dirPath);
 
 		void deleteResourceInternal(ResourceEntry* resource);
 		void deleteDirectoryInternal(DirectoryEntry* directory);
 
 		void reimportResourceInternal(ResourceEntry* resource);
 
-		void createInternalParentHierarchy(const CM::WPath& fullPath, DirectoryEntry** newHierarchyRoot, DirectoryEntry** newHierarchyLeaf);
+		void createInternalParentHierarchy(const CM::WString& fullPath, DirectoryEntry** newHierarchyRoot, DirectoryEntry** newHierarchyLeaf);
 
 		bool isUpToDate(ResourceEntry* resource) const;
-		CM::WPath getMetaPath(const CM::WPath& path) const;
-		bool isMeta(const CM::WPath& fullPath) const;
+		CM::WString getMetaPath(const CM::WString& path) const;
+		bool isMeta(const CM::WString& fullPath) const;
 
 		void onMonitorFileModified(const CM::WString& path);
 	};

+ 25 - 24
CamelotClient/Source/BsGUIResourceTreeView.cpp

@@ -10,6 +10,7 @@
 #include "CmViewport.h"
 #include "CmRenderWindow.h"
 #include "CmPlatform.h"
+#include "CmPath.h"
 
 using namespace CamelotFramework;
 using namespace BansheeEngine;
@@ -49,8 +50,8 @@ namespace BansheeEditor
 
 		const ProjectLibrary::LibraryEntry* rootEntry = ProjectLibrary::instance().getRootEntry();
 
-		mRootElement.mFullPath = toWString(rootEntry->path);
-		mRootElement.mElementName = PathUtil::getFilename(mRootElement.mFullPath);
+		mRootElement.mFullPath = rootEntry->path;
+		mRootElement.mElementName = Path::getFilename(mRootElement.mFullPath);
 		expandElement(&mRootElement);
 
 		Stack<StackElem>::type todo;
@@ -65,7 +66,7 @@ namespace BansheeEditor
 
 			for(auto& child : dirEntry->mChildren)
 			{
-				ResourceTreeElement* newChild = addTreeElement(curElem.treeElem, toWString(child->path));
+				ResourceTreeElement* newChild = addTreeElement(curElem.treeElem, child->path);
 
 				if(child->type == ProjectLibrary::LibraryEntryType::Directory)
 					todo.push(StackElem(child, newChild));
@@ -124,20 +125,20 @@ namespace BansheeEditor
 		ResourceTreeElement* resourceTreeElement = static_cast<ResourceTreeElement*>(element);
 		
 		WString oldPath = resourceTreeElement->mFullPath;
-		WString newPath = PathUtil::combine(PathUtil::parentPath(oldPath), name);
+		WString newPath = Path::combine(Path::parentPath(oldPath), name);
 
-		ProjectLibrary::instance().moveEntry(toPath(oldPath), toPath(findUniquePath(newPath)));
+		ProjectLibrary::instance().moveEntry(oldPath, findUniquePath(newPath));
 	}
 
 	GUIResourceTreeView::ResourceTreeElement* GUIResourceTreeView::addTreeElement(ResourceTreeElement* parent, const CM::WString& fullPath)
 	{
 		ResourceTreeElement* newChild = cm_new<ResourceTreeElement>();
 		newChild->mParent = parent;
-		newChild->mName = toString(PathUtil::getFilename(fullPath));
+		newChild->mName = toString(Path::getFilename(fullPath));
 		newChild->mFullPath = fullPath;
 		newChild->mSortedIdx = (UINT32)parent->mChildren.size();
 		newChild->mIsVisible = parent->mIsVisible && parent->mIsExpanded;
-		newChild->mElementName = PathUtil::getFilename(fullPath);
+		newChild->mElementName = Path::getFilename(fullPath);
 
 		parent->mChildren.push_back(newChild);
 
@@ -198,13 +199,13 @@ namespace BansheeEditor
 
 	GUIResourceTreeView::ResourceTreeElement* GUIResourceTreeView::findTreeElement(const CM::WString& fullPath)
 	{
-		Vector<WString>::type pathElems = PathUtil::split(fullPath);
-		Vector<WString>::type rootElems = PathUtil::split(mRootElement.mFullPath);
+		Vector<WString>::type pathElems = Path::split(fullPath);
+		Vector<WString>::type rootElems = Path::split(mRootElement.mFullPath);
 
 		auto pathIter = pathElems.begin();
 		auto rootIter = rootElems.begin();
 
-		while(pathIter != pathElems.end() && rootIter != rootElems.end() && PathUtil::comparePathElements(*pathIter, *rootIter))
+		while(pathIter != pathElems.end() && rootIter != rootElems.end() && Path::comparePathElements(*pathIter, *rootIter))
 		{
 			++pathIter;
 			++rootIter;
@@ -223,7 +224,7 @@ namespace BansheeEditor
 			ResourceTreeElement* current = todo.top();
 			todo.pop();
 
-			if(PathUtil::comparePathElements(*pathIter, current->mElementName))
+			if(Path::comparePathElements(*pathIter, current->mElementName))
 			{
 				++pathIter;
 
@@ -241,22 +242,22 @@ namespace BansheeEditor
 		return nullptr;
 	}
 
-	void GUIResourceTreeView::entryAdded(const WPath& path)
+	void GUIResourceTreeView::entryAdded(const WString& path)
 	{
-		WPath parentPath = PathUtil::parentPath(path);
+		WString parentPath = Path::parentPath(path);
 
-		ResourceTreeElement* parentElement = findTreeElement(toWString(parentPath));
+		ResourceTreeElement* parentElement = findTreeElement(parentPath);
 		assert(parentElement != nullptr);
 
-		addTreeElement(parentElement, toWString(path));
+		addTreeElement(parentElement, path);
 		sortTreeElement(parentElement);
 
 		markContentAsDirty();
 	}
 
-	void GUIResourceTreeView::entryRemoved(const WPath& path)
+	void GUIResourceTreeView::entryRemoved(const WString& path)
 	{
-		ResourceTreeElement* treeElement = findTreeElement(toWString(path));
+		ResourceTreeElement* treeElement = findTreeElement(path);
 		
 		if(treeElement != nullptr)
 			deleteTreeElement(treeElement);
@@ -360,14 +361,14 @@ namespace BansheeEditor
 		if(FileSystem::exists(path))
 		{
 			WString noExtensionPath = path;
-			WString extension = PathUtil::getExtension(path);
-			PathUtil::replaceExtension(noExtensionPath, L"");
+			WString extension = Path::getExtension(path);
+			Path::replaceExtension(noExtensionPath, L"");
 
 			WString newPath;
 			UINT32 cnt = 1;
 			do 
 			{
-				newPath = PathUtil::combine(PathUtil::combine(noExtensionPath, L" " + toWString(cnt)), extension);
+				newPath = Path::combine(Path::combine(noExtensionPath, L" " + toWString(cnt)), extension);
 				cnt++;
 			} while (FileSystem::exists(newPath));
 
@@ -416,14 +417,14 @@ namespace BansheeEditor
 
 			WString destDir = resourceTreeElement->mFullPath;
 			if(FileSystem::isFile(destDir))
-				destDir = PathUtil::parentPath(destDir);
+				destDir = Path::parentPath(destDir);
 
 			for(UINT32 i = 0; i < mDraggedResources->numObjects; i++)
 			{
-				WString filename = PathUtil::getFilename(mDraggedResources->resourcePaths[i]);
+				WString filename = Path::getFilename(mDraggedResources->resourcePaths[i]);
 
-				WString newPath = PathUtil::combine(destDir, filename);
-				ProjectLibrary::instance().moveEntry(toPath(mDraggedResources->resourcePaths[i]), toPath(findUniquePath(newPath)));
+				WString newPath = Path::combine(destDir, filename);
+				ProjectLibrary::instance().moveEntry(mDraggedResources->resourcePaths[i], findUniquePath(newPath));
 			}
 		}
 	}

+ 57 - 57
CamelotClient/Source/BsProjectLibrary.cpp

@@ -21,15 +21,15 @@ namespace BansheeEditor
 {
 	const WString ProjectLibrary::INTERNAL_RESOURCES_DIR = L"Internal\\Resources";
 
-	ProjectLibrary::LibraryEntry::LibraryEntry(const CM::WPath& path, const CM::WString& name, DirectoryEntry* parent, LibraryEntryType type)
+	ProjectLibrary::LibraryEntry::LibraryEntry(const CM::WString& path, const CM::WString& name, DirectoryEntry* parent, LibraryEntryType type)
 		:path(path), parent(parent), type(type), elementName(name)
 	{ }
 
-	ProjectLibrary::ResourceEntry::ResourceEntry(const CM::WPath& path, const CM::WString& name, DirectoryEntry* parent)
+	ProjectLibrary::ResourceEntry::ResourceEntry(const CM::WString& path, const CM::WString& name, DirectoryEntry* parent)
 		:LibraryEntry(path, name, parent, LibraryEntryType::File), lastUpdateTime(0)
 	{ }
 
-	ProjectLibrary::DirectoryEntry::DirectoryEntry(const CM::WPath& path, const CM::WString& name, DirectoryEntry* parent)
+	ProjectLibrary::DirectoryEntry::DirectoryEntry(const CM::WString& path, const CM::WString& name, DirectoryEntry* parent)
 		:LibraryEntry(path, name, parent, LibraryEntryType::Directory)
 	{ }
 
@@ -68,20 +68,20 @@ namespace BansheeEditor
 
 	void ProjectLibrary::checkForModifications(const CM::WString& fullPath)
 	{
-		if(!PathUtil::includes(fullPath, EditorApplication::instance().getResourcesFolderPath()))
+		if(!Path::includes(fullPath, EditorApplication::instance().getResourcesFolderPath()))
 			return; // Folder not part of our resources path, so no modifications
 
 		if(mRootEntry == nullptr)
 		{
-			WPath resPath = toPath(EditorApplication::instance().getResourcesFolderPath());
-			mRootEntry = cm_new<DirectoryEntry>(resPath, toWString(PathUtil::getFilename(resPath)), nullptr);
+			WString resPath = EditorApplication::instance().getResourcesFolderPath();
+			mRootEntry = cm_new<DirectoryEntry>(resPath, Path::getFilename(resPath), nullptr);
 		}
 
-		WPath pathToSearch = toPath(fullPath);
+		WString pathToSearch = fullPath;
 		LibraryEntry* entry = findEntry(pathToSearch);
 		if(entry == nullptr) // File could be new, try to find parent directory entry
 		{
-			WPath parentDirPath = PathUtil::parentPath(pathToSearch);
+			WString parentDirPath = Path::parentPath(pathToSearch);
 			entry = findEntry(parentDirPath);
 
 			// Cannot find parent directory. Create the needed hierarchy.
@@ -101,11 +101,11 @@ namespace BansheeEditor
 				addDirectoryInternal(entryParent, pathToSearch);
 
 				if(newHierarchyParent == nullptr)
-					checkForModifications(toWString(pathToSearch));
+					checkForModifications(pathToSearch);
 			}
 
 			if(newHierarchyParent != nullptr)
-				checkForModifications(toWString(newHierarchyParent->path));
+				checkForModifications(newHierarchyParent->path);
 		}
 		else if(entry->type == LibraryEntryType::File)
 		{
@@ -129,8 +129,8 @@ namespace BansheeEditor
 				Stack<DirectoryEntry*>::type todo;
 				todo.push(static_cast<DirectoryEntry*>(entry));
 
-				Vector<WPath>::type childFiles;
-				Vector<WPath>::type childDirectories;
+				Vector<WString>::type childFiles;
+				Vector<WString>::type childDirectories;
 				Vector<bool>::type existingEntries;
 				Vector<LibraryEntry*>::type toDelete;
 
@@ -153,8 +153,8 @@ namespace BansheeEditor
 					{
 						if(isMeta(filePath))
 						{
-							WPath sourceFilePath = filePath;
-							PathUtil::replaceExtension(sourceFilePath, L"");
+							WString sourceFilePath = filePath;
+							Path::replaceExtension(sourceFilePath, L"");
 
 							if(FileSystem::isFile(sourceFilePath))
 							{
@@ -238,9 +238,9 @@ namespace BansheeEditor
 		}
 	}
 
-	ProjectLibrary::ResourceEntry* ProjectLibrary::addResourceInternal(DirectoryEntry* parent, const CM::WPath& filePath)
+	ProjectLibrary::ResourceEntry* ProjectLibrary::addResourceInternal(DirectoryEntry* parent, const CM::WString& filePath)
 	{
-		ResourceEntry* newResource = cm_new<ResourceEntry>(filePath, toWString(PathUtil::getFilename(filePath)), parent);
+		ResourceEntry* newResource = cm_new<ResourceEntry>(filePath, Path::getFilename(filePath), parent);
 		parent->mChildren.push_back(newResource);
 
 		reimportResourceInternal(newResource);
@@ -251,9 +251,9 @@ namespace BansheeEditor
 		return newResource;
 	}
 
-	ProjectLibrary::DirectoryEntry* ProjectLibrary::addDirectoryInternal(DirectoryEntry* parent, const CM::WPath& dirPath)
+	ProjectLibrary::DirectoryEntry* ProjectLibrary::addDirectoryInternal(DirectoryEntry* parent, const CM::WString& dirPath)
 	{
-		DirectoryEntry* newEntry = cm_new<DirectoryEntry>(dirPath, toWString(PathUtil::getFilename(dirPath)), parent);
+		DirectoryEntry* newEntry = cm_new<DirectoryEntry>(dirPath, Path::getFilename(dirPath), parent);
 		parent->mChildren.push_back(newEntry);
 
 		if(!onEntryAdded.empty())
@@ -317,9 +317,9 @@ namespace BansheeEditor
 
 	void ProjectLibrary::reimportResourceInternal(ResourceEntry* resource)
 	{
-		WString ext = toWString(PathUtil::getExtension(resource->path));
-		WPath metaPath = resource->path;
-		PathUtil::replaceExtension(metaPath, ext + L".meta");
+		WString ext = Path::getExtension(resource->path);
+		WString metaPath = resource->path;
+		Path::replaceExtension(metaPath, ext + L".meta");
 
 		ext = ext.substr(1, ext.size() - 1); // Remove the .
 		if(!Importer::instance().supportsFileType(ext))
@@ -330,7 +330,7 @@ namespace BansheeEditor
 			FileSerializer fs;
 			if(FileSystem::isFile(metaPath))
 			{
-				std::shared_ptr<IReflectable> loadedMeta = fs.decode(toWString(metaPath));
+				std::shared_ptr<IReflectable> loadedMeta = fs.decode(metaPath);
 
 				if(loadedMeta != nullptr && loadedMeta->isDerivedFrom(ResourceMeta::getRTTIStatic()))
 				{
@@ -347,27 +347,27 @@ namespace BansheeEditor
 			if(resource->meta != nullptr)
 				importOptions = resource->meta->getImportOptions();
 			else
-				importOptions = Importer::instance().createImportOptions(toWString(resource->path));
+				importOptions = Importer::instance().createImportOptions(resource->path);
 
-			HResource importedResource = Importer::instance().import(toWString(resource->path), importOptions);
+			HResource importedResource = Importer::instance().import(resource->path, importOptions);
 
 			if(resource->meta == nullptr)
 			{
 				resource->meta = ResourceMeta::create(importedResource.getUUID(), importOptions);
 				FileSerializer fs;
-				fs.encode(resource->meta.get(), toWString(metaPath));
+				fs.encode(resource->meta.get(), metaPath);
 			}
 
-			WPath internalResourcesPath = toPath(EditorApplication::instance().getActiveProjectPath()) / toPath(INTERNAL_RESOURCES_DIR);
+			WString internalResourcesPath = Path::combine(EditorApplication::instance().getActiveProjectPath(), INTERNAL_RESOURCES_DIR);
 			if(!FileSystem::isDirectory(internalResourcesPath))
 				FileSystem::createDir(internalResourcesPath);
 
-			internalResourcesPath /= toPath(toWString(importedResource.getUUID()) + L".asset");
+			internalResourcesPath = Path::combine(internalResourcesPath, toWString(importedResource.getUUID()) + L".asset");
 
-			gResources().save(importedResource, toWString(internalResourcesPath), true);
+			gResources().save(importedResource, internalResourcesPath, true);
 
 			ResourceManifestPtr manifest = gResources().getResourceManifest();
-			manifest->registerResource(importedResource.getUUID(), toWString(internalResourcesPath));
+			manifest->registerResource(importedResource.getUUID(), internalResourcesPath);
 
 			resource->lastUpdateTime = std::time(nullptr);
 		}
@@ -391,15 +391,15 @@ namespace BansheeEditor
 		return lastModifiedTime <= resource->lastUpdateTime;
 	}
 
-	ProjectLibrary::LibraryEntry* ProjectLibrary::findEntry(const CM::WPath& fullPath) const
+	ProjectLibrary::LibraryEntry* ProjectLibrary::findEntry(const CM::WString& fullPath) const
 	{
-		Vector<WString>::type pathElems = PathUtil::split(toWString(fullPath));
-		Vector<WString>::type rootElems = PathUtil::split(toWString(mRootEntry->path));
+		Vector<WString>::type pathElems = Path::split(fullPath);
+		Vector<WString>::type rootElems = Path::split(mRootEntry->path);
 
 		auto pathIter = pathElems.begin();
 		auto rootIter = rootElems.begin();
 
-		while(pathIter != pathElems.end() && rootIter != rootElems.end() && PathUtil::comparePathElements(*pathIter, *rootIter))
+		while(pathIter != pathElems.end() && rootIter != rootElems.end() && Path::comparePathElements(*pathIter, *rootIter))
 		{
 			++pathIter;
 			++rootIter;
@@ -417,7 +417,7 @@ namespace BansheeEditor
 			LibraryEntry* current = todo.top();
 			todo.pop();
 
-			if(PathUtil::comparePathElements(*pathIter, current->elementName))
+			if(Path::comparePathElements(*pathIter, current->elementName))
 			{
 				++pathIter;
 
@@ -439,19 +439,19 @@ namespace BansheeEditor
 		return nullptr;
 	}
 
-	void ProjectLibrary::moveEntry(const CM::WPath& oldPath, const CM::WPath& newPath)
+	void ProjectLibrary::moveEntry(const CM::WString& oldPath, const CM::WString& newPath)
 	{
 		if(FileSystem::isFile(oldPath) || FileSystem::isDirectory(oldPath))
 			FileSystem::move(oldPath, newPath);
 
-		WPath oldMetaPath = getMetaPath(oldPath);
-		WPath newMetaPath = getMetaPath(newPath);
+		WString oldMetaPath = getMetaPath(oldPath);
+		WString newMetaPath = getMetaPath(newPath);
 
 		LibraryEntry* oldEntry = findEntry(oldPath);
 		if(oldEntry != nullptr) // Moving from the Resources folder
 		{
 			// Moved outside of Resources, delete entry & meta file
-			if(!PathUtil::includes(toWString(newPath), EditorApplication::instance().getResourcesFolderPath()))
+			if(!Path::includes(newPath, EditorApplication::instance().getResourcesFolderPath()))
 			{
 				if(oldEntry->type == LibraryEntryType::File)
 				{
@@ -473,7 +473,7 @@ namespace BansheeEditor
 				if(findIter != parent->mChildren.end())
 					parent->mChildren.erase(findIter);
 
-				WPath parentPath = PathUtil::parentPath(newPath);
+				WString parentPath = Path::parentPath(newPath);
 
 				DirectoryEntry* newEntryParent = nullptr;
 				LibraryEntry* newEntryParentLib = findEntry(parentPath);
@@ -490,7 +490,7 @@ namespace BansheeEditor
 				newEntryParent->mChildren.push_back(oldEntry);
 				oldEntry->parent = newEntryParent;
 				oldEntry->path = newPath;
-				oldEntry->elementName = toWString(PathUtil::getFilename(newPath));
+				oldEntry->elementName = Path::getFilename(newPath);
 
 				if(!onEntryRemoved.empty())
 					onEntryRemoved(oldPath);
@@ -499,16 +499,16 @@ namespace BansheeEditor
 					onEntryAdded(newPath);
 
 				if(newHierarchyParent != nullptr)
-					checkForModifications(toWString(newHierarchyParent->path));
+					checkForModifications(newHierarchyParent->path);
 			}
 		}
 		else // Moving from outside of the Resources folder (likely adding a new resource)
 		{
-			checkForModifications(toWString(newPath));
+			checkForModifications(newPath);
 		}
 	}
 
-	void ProjectLibrary::deleteEntry(const CM::WPath& path)
+	void ProjectLibrary::deleteEntry(const CM::WString& path)
 	{
 		if(FileSystem::isFile(path))
 			FileSystem::remove(path);
@@ -520,7 +520,7 @@ namespace BansheeEditor
 			{
 				deleteResourceInternal(static_cast<ResourceEntry*>(entry));
 
-				WPath metaPath = getMetaPath(path);
+				WString metaPath = getMetaPath(path);
 				if(FileSystem::isFile(metaPath))
 					FileSystem::remove(metaPath);
 			}
@@ -529,15 +529,15 @@ namespace BansheeEditor
 		}
 	}
 
-	void ProjectLibrary::createInternalParentHierarchy(const CM::WPath& fullPath, DirectoryEntry** newHierarchyRoot, DirectoryEntry** newHierarchyLeaf)
+	void ProjectLibrary::createInternalParentHierarchy(const CM::WString& fullPath, DirectoryEntry** newHierarchyRoot, DirectoryEntry** newHierarchyLeaf)
 	{
-		WPath parentPath = fullPath;
+		WString parentPath = fullPath;
 
 		DirectoryEntry* newEntryParent = nullptr;
-		Stack<WPath>::type parentPaths;
+		Stack<WString>::type parentPaths;
 		do 
 		{
-			WPath newParentPath = PathUtil::parentPath(parentPath);
+			WString newParentPath = Path::parentPath(parentPath);
 
 			if(newParentPath == parentPath)
 				break;
@@ -563,7 +563,7 @@ namespace BansheeEditor
 
 		while(!parentPaths.empty())
 		{
-			WPath curPath = parentPaths.top();
+			WString curPath = parentPaths.top();
 			parentPaths.pop();
 
 			newEntryParent = addDirectoryInternal(newEntryParent, curPath);
@@ -573,28 +573,28 @@ namespace BansheeEditor
 			*newHierarchyLeaf = newEntryParent;
 	}
 
-	WPath ProjectLibrary::getMetaPath(const CM::WPath& path) const
+	WString ProjectLibrary::getMetaPath(const CM::WString& path) const
 	{
-		WPath metaPath = toPath(toWString(path) + L".meta");
+		WString metaPath = path + L".meta";
 
 		return metaPath;
 	}
 
-	bool ProjectLibrary::isMeta(const WPath& fullPath) const
+	bool ProjectLibrary::isMeta(const WString& fullPath) const
 	{
-		return PathUtil::getExtension(fullPath) == toPath(L".meta");
+		return Path::getExtension(fullPath) == L".meta";
 	}
 
 	void ProjectLibrary::onMonitorFileModified(const WString& path)
 	{
-		if(!isMeta(toPath(path)))
+		if(!isMeta(path))
 			checkForModifications(path);
 		else
 		{
-			WPath resourcePath = toPath(path);
-			PathUtil::replaceExtension(resourcePath, L"");
+			WString resourcePath = path;
+			Path::replaceExtension(resourcePath, L"");
 
-			checkForModifications(toWString(resourcePath));
+			checkForModifications(resourcePath);
 		}
 	}
 }

+ 1 - 1
CamelotCore/Source/CmGpuProgramImporter.cpp

@@ -23,7 +23,7 @@ namespace CamelotFramework
 
 	HResource GpuProgramImporter::import(const WString& filePath, ConstImportOptionsPtr importOptions)
 	{
-		WString ext = PathUtil::getExtension(filePath);
+		WString ext = Path::getExtension(filePath);
 		ext = ext.substr(1, ext.size() - 1); // Remove the .
 
 		DataStreamPtr stream = FileSystem::openFile(filePath);

+ 1 - 1
CamelotCore/Source/CmImporter.cpp

@@ -108,7 +108,7 @@ namespace CamelotFramework
 
 	SpecificImporter* Importer::getImporterForFile(const WString& inputFilePath) const
 	{
-		WString ext = PathUtil::getExtension(inputFilePath);
+		WString ext = Path::getExtension(inputFilePath);
 		ext = ext.substr(1, ext.size() - 1); // Remove the .
 		if(!supportsFileType(ext))
 		{

+ 2 - 12
CamelotUtility/Include/CmFileSystem.h

@@ -1,7 +1,6 @@
 #pragma once
 
 #include "CmPrerequisitesUtil.h"
-#include "CmPath.h"
 
 namespace CamelotFramework
 {
@@ -14,26 +13,17 @@ namespace CamelotFramework
 		static UINT64 getFileSize(const WString& fullPath);
 
 		static void remove(const WString& fullPath, bool recursively = true);
-		static void remove(const WPath& fullPath, bool recursively = true);
-
-		static void move(const WPath& oldPath, const WPath& newPath, bool overwriteExisting = true);
+		static void move(const WString& oldPath, const WString& newPath, bool overwriteExisting = true);
 
 		static void createDir(const WString& fullPath);
-		static void createDir(const WPath& fullPath);
 
 		static bool exists(const WString& fullPath);
-		static bool exists(const WPath& fullPath);
-
 		static bool isFile(const WString& fullPath);
-		static bool isFile(const WPath& fullPath);
-		
 		static bool isDirectory(const WString& fullPath);
-		static bool isDirectory(const WPath& fullPath);
 
-		static void getChildren(const WPath& dirPath, Vector<WPath>::type& files, Vector<WPath>::type& directories);
+		static void getChildren(const WString& dirPath, Vector<WString>::type& files, Vector<WString>::type& directories);
 
 		static std::time_t getLastModifiedTime(const WString& fullPath);
-		static std::time_t getLastModifiedTime(const WPath& fullPath);
 
 		static WString getWorkingDirectoryPath();
 		static WString getParentDirectory(const WString& path);

+ 8 - 84
CamelotUtility/Include/CmPath.h

@@ -5,57 +5,35 @@
 
 namespace CamelotFramework
 {
-	typedef boost::filesystem3::path Path;
-	typedef boost::filesystem3::wpath WPath;
-
-	Path CM_UTILITY_EXPORT toPath(const String& p);
-	WPath CM_UTILITY_EXPORT toPath(const WString& p);
-
-	String CM_UTILITY_EXPORT toString(const Path& p);
-	WString CM_UTILITY_EXPORT toWString(const WPath& p);
-
 	/**
 	 * @brief	Various string manipulations of file paths.
 	 */
-	class CM_UTILITY_EXPORT PathUtil
+	class CM_UTILITY_EXPORT Path
 	{
 	public:
-		static const WPath BLANK;
-
 		static WString getExtension(const WString& path)
 		{
 			boost::filesystem3::wpath ext = boost::filesystem3::extension(boost::filesystem3::wpath(path.c_str()));
 			return ext.wstring().c_str();
 		}
 
-		static WPath getExtension(const WPath& path)
-		{
-			return boost::filesystem3::extension(path);
-		}
-
 		static bool hasExtension(const WString& path, const WString& extension)
 		{
 			return getExtension(path) == extension;
 		}
 
-		static void replaceExtension(WPath& path, const WString& newExtension)
-		{
-			path.replace_extension(newExtension.c_str());
-		}
-
 		static void replaceExtension(WString& path, const WString& newExtension)
 		{
-			path = toWString(toPath(path).replace_extension(newExtension.c_str()));
+			boost::filesystem3::path internalPath = path.c_str();
+
+			path = internalPath.replace_extension(newExtension.c_str()).c_str();
 		}
 
 		static WString parentPath(const WString& path)
 		{
-			return WPath(path.c_str()).parent_path().c_str();
-		}
+			boost::filesystem3::path internalPath = path.c_str();
 
-		static WPath parentPath(const WPath& path)
-		{
-			return path.parent_path();
+			return internalPath.parent_path().c_str();
 		}
 
 		/**
@@ -95,11 +73,6 @@ namespace CamelotFramework
 				return base + L'/' + name;
 		}
 
-		static WPath combine(const WPath& base, const WPath& name)
-		{
-			return base / name;
-		}
-
 		/**
 		 * @brief	Compares two path elements for equality. 
 		 * 			
@@ -125,35 +98,11 @@ namespace CamelotFramework
 			return true;
 		}
 
-		/**
-		 * @see		comparePathElements(const WString&, const WString&)
-		 */
-		static bool comparePathElements(const WPath& left, const WPath& right)
-		{
-			if(left.native().size() != right.native().size())
-				return false;
-
-			for(UINT32 i = 0; i < (UINT32)left.native().size(); i++)
-			{
-#if CM_PLATFORM == CM_PLATFORM_WIN32 // Compare case insensitive
-				if(tolower(left.native()[i]) != tolower(right.native()[i]))
-					return false;
-#else
-				assert(false); // Implement case sensitive or insensitive comparison, depending on platform
-#endif
-			}
-
-			return true;
-		}
-
 		static WString getFilename(const WString& path)
 		{
-			return toWString(toPath(path).filename());
-		}
+			boost::filesystem3::path internalPath = path.c_str();
 
-		static WPath getFilename(const WPath& path)
-		{
-			return path.filename();
+			return internalPath.filename().c_str();
 		}
 
 		/**
@@ -174,29 +123,4 @@ namespace CamelotFramework
 			return path;
 		}
 	};
-
-	template<> struct RTTIPlainType<WPath>
-	{	
-		enum { id = TID_WPath }; enum { hasDynamicSize = 1 };
-
-		static void toMemory(const WPath& data, char* memory)
-		{ 
-			rttiWriteElem(toWString(data), memory);
-		}
-
-		static UINT32 fromMemory(WPath& data, char* memory)
-		{ 
-			WString strData;
-
-			RTTIPlainType<WString>::fromMemory(strData, memory);
-			data = toPath(strData);
-
-			return rttiGetElemSize(strData);
-		}
-
-		static UINT32 getDynamicSize(const WPath& data)	
-		{ 
-			return rttiGetElemSize(toWString(data));
-		}	
-	}; 
 }

+ 17 - 53
CamelotUtility/Source/CmFileSystem.cpp

@@ -82,27 +82,22 @@ namespace CamelotFramework
 			boost::filesystem3::remove(fullPath.c_str());
 	}
 
-	void FileSystem::remove(const WPath& fullPath, bool recursively)
+	void FileSystem::move(const WString& oldPath, const WString& newPath, bool overwriteExisting)
 	{
-		if(recursively)
-			boost::filesystem3::remove_all(fullPath);
-		else
-			boost::filesystem3::remove(fullPath);
-	}
+		boost::filesystem3::path oldPathInternal = oldPath.c_str();
+		boost::filesystem3::path newPathInternal = newPath.c_str();
 
-	void FileSystem::move(const WPath& oldPath, const WPath& newPath, bool overwriteExisting)
-	{
-		if(FileSystem::isFile(newPath) || FileSystem::isDirectory(newPath))
+		if(boost::filesystem3::exists(newPathInternal))
 		{
 			if(overwriteExisting)
-				FileSystem::remove(newPath, true);
+				boost::filesystem3::remove_all(newPathInternal);
 			else
 			{
-				CM_EXCEPT(InvalidStateException, "Move operation failed because another file already exists at the new path: \"" + toString(newPath) + "\"");
+				CM_EXCEPT(InvalidStateException, "Move operation failed because another file already exists at the new path: \"" + toString(WString(newPathInternal.c_str())) + "\"");
 			}
 		}
 
-		boost::filesystem3::rename(oldPath, newPath);
+		boost::filesystem3::rename(oldPathInternal, newPathInternal);
 	}
 
 	bool FileSystem::exists(const WString& fullPath)
@@ -110,11 +105,6 @@ namespace CamelotFramework
 		return boost::filesystem3::exists(fullPath.c_str());
 	}
 
-	bool FileSystem::exists(const WPath& fullPath)
-	{
-		return boost::filesystem3::exists(fullPath);
-	}
-
 	bool FileSystem::isFile(const WString& fullPath)
 	{
 		if(boost::filesystem3::exists(fullPath.c_str()) && !is_directory(fullPath.c_str()))
@@ -123,14 +113,6 @@ namespace CamelotFramework
 		return false;
 	}
 
-	bool FileSystem::isFile(const WPath& fullPath)
-	{
-		if(exists(fullPath) && !is_directory(fullPath))
-			return true;
-
-		return false;
-	}
-
 	bool FileSystem::isDirectory(const WString& fullPath)
 	{
 		if(boost::filesystem3::exists(fullPath.c_str()) && is_directory(fullPath.c_str()))
@@ -139,37 +121,25 @@ namespace CamelotFramework
 		return false;
 	}
 
-	bool FileSystem::isDirectory(const WPath& fullPath)
-	{
-		if(boost::filesystem3::exists(fullPath) && is_directory(fullPath))
-			return true;
-
-		return false;
-	}
-
 	void FileSystem::createDir(const WString& fullPath)
 	{
-		createDir(WPath(fullPath.c_str()));
-	}
-
-	void FileSystem::createDir(const WPath& fullPath)
-	{
-		if(fullPath.empty())
+		boost::filesystem3::path fullPathInternal = fullPath.c_str();
+		if(fullPathInternal.empty())
 			return;
 
-		WPath parentPath = fullPath;
-		auto pathEnd = fullPath.end();
+		boost::filesystem3::path parentPath = fullPathInternal;
+		auto pathEnd = fullPathInternal.end();
 
-		while(!exists(parentPath))
+		while(!boost::filesystem3::exists(parentPath))
 		{
-			if(pathEnd == fullPath.begin())
+			if(pathEnd == fullPathInternal.begin())
 				break;
 
 			parentPath = parentPath.parent_path();
 			pathEnd--;
 		}
 
-		for(; pathEnd != fullPath.end(); ++pathEnd)
+		for(; pathEnd != fullPathInternal.end(); ++pathEnd)
 		{
 			create_directory(parentPath);
 
@@ -179,7 +149,7 @@ namespace CamelotFramework
 		create_directory(parentPath);
 	}
 
-	void FileSystem::getChildren(const WPath& dirPath, Vector<WPath>::type& files, Vector<WPath>::type& directories)
+	void FileSystem::getChildren(const WString& dirPath, Vector<WString>::type& files, Vector<WString>::type& directories)
 	{
 		directory_iterator dirIter(dirPath.c_str());
 
@@ -189,24 +159,18 @@ namespace CamelotFramework
 			boost::filesystem3::path curPath = dirIter->path();
 
 			if(is_regular_file(curPath))
-				files.push_back(curPath);
+				files.push_back(curPath.c_str());
 			else if(is_directory(curPath))
-				directories.push_back(curPath);
+				directories.push_back(curPath.c_str());
 
 			dirIter++;
 		}
 	}
-
 	std::time_t FileSystem::getLastModifiedTime(const WString& fullPath)
 	{
 		return last_write_time(fullPath.c_str());
 	}
 
-	std::time_t FileSystem::getLastModifiedTime(const WPath& fullPath)
-	{
-		return last_write_time(fullPath);
-	}
-
 	WString FileSystem::getWorkingDirectoryPath()
 	{
 		return current_path().wstring().c_str();

+ 0 - 6
CamelotUtility/Source/CmPath.cpp

@@ -2,11 +2,5 @@
 
 namespace CamelotFramework
 {
-	const WPath PathUtil::BLANK = WPath();
 
-	Path toPath(const String& p) { return p.c_str(); }
-	WPath toPath(const WString& p) { return p.c_str(); }
-
-	String toString(const Path& p) { return String(p.string().c_str()); }
-	WString toWString(const WPath& p) { return WString(p.wstring().c_str()); }
 }