Ver código fonte

Add a method in Path that returns a wstring on Windows and a string elsewhere

Marc Legendre 9 anos atrás
pai
commit
92de44dc57
1 arquivos alterados com 11 adições e 0 exclusões
  1. 11 0
      Source/BansheeUtility/Include/BsPath.h

+ 11 - 0
Source/BansheeUtility/Include/BsPath.h

@@ -172,6 +172,17 @@ namespace BansheeEngine
 		 */
 		String toString(PathType type = PathType::Default) const;
 
+		/**
+		 * Converts the path to either a string or a wstring, doing The Right Thing for the current platform.
+         *
+         * This method is equivalent to toWString() on Windows, and to toString() elsewhere.
+		 */
+#if BS_PLATFORM == BS_PLATFORM_WIN32
+		WString toPlatformString() const { return toWString(); }
+#else
+		String toPlatformString() const { return toString(); }
+#endif
+
 		/** Checks is the path a directory (contains no file-name). */
 		bool isDirectory() const { return mFilename.empty(); }