Daniele Bartolini 11 ani în urmă
părinte
comite
6fabcfd006
2 a modificat fișierele cu 1 adăugiri și 109 ștergeri
  1. 1 95
      engine/core/strings/path.cpp
  2. 0 14
      engine/core/strings/path.h

+ 1 - 95
engine/core/strings/path.cpp

@@ -4,94 +4,13 @@
  */
 
 #include "path.h"
+#include "platform.h"
 #include <ctype.h> // isalpha
 
 namespace crown
 {
 namespace path
 {
-	bool is_valid_segment(const char* segment)
-	{
-		CE_ASSERT(segment != NULL, "Segment must be != NULL");
-
-		size_t segment_len = strlen(segment);
-
-		// Empty segment is not valid
-		if (segment_len == 0)
-		{
-			return false;
-		}
-
-		// Segments containing only '.' are non valid
-		if (segment_len == 1 && segment[0] == '.')
-		{
-			return false;
-		}
-
-		// Segments containing only ".." are not valid
-		if (segment_len == 2 && segment[0] == '.' && segment[1] == '.')
-		{
-			return false;
-		}
-
-		// The segment does not have to contain any forward slashes ('/')
-		// nor back slashes ('\'), nor colon signs (':')
-		for (size_t i = 0; i < segment_len; i++)
-		{
-			if (segment[i] == '/' ||
-				segment[i] == '\\' ||
-				segment[i] == ':')
-			{
-				return false;
-			}
-		}
-
-		return true;
-	}
-
-	/// Returns whether the path is valid.
-	/// @note
-	/// The rules for valid paths are as follows:
-	/// a) The empty string is not valid.
-	/// b) If the path is absolute, it mustn't contain any leading character.
-	bool is_valid_path(const char* path)
-	{
-		(void)path;
-	//	size_t path_len = strlen(path);
-
-	//	if (pathLen == 0)
-	//	{
-	//		return false;
-	//	}
-
-	//	if (is_root_path(path))
-	//	{
-	//		return true;
-	//	}
-
-	//	Array<Str> segmentList;
-	//	if (!get_segments(Str(path), segmentList))
-	//	{
-	//		return false;
-	//	}
-
-	//	size_t i = 0;
-	//	if (IsAbsolutePath(path) && path[0] != '/')
-	//	{
-	//		i = 1;
-	//	}
-
-	//	for (; i < segmentList.GetSize(); i++)
-	//	{
-	//		if (!IsValidSegment(segmentList[i].c_str()))
-	//		{
-	//			return false;
-	//		}
-	//	}
-
-		return true;
-	}
-
 	bool is_absolute_path(const char* path)
 	{
 		CE_ASSERT(path != NULL, "Path must be != NULL");
@@ -234,19 +153,6 @@ namespace path
 		substring(begin(path), last_dot, str, len);
 	}
 
-	/// Returns the segments contained in path.
-	//bool segments(const char* path, Array<Str>& ret)
-	//{
-	//	path.Split(os::PATH_SEPARATOR, ret);
-
-	//	if (ret.GetSize() > 0)
-	//	{
-	//		return true;
-	//	}
-
-	//	return false;
-	//}
-
 	/// Fills 'ret' with the same path but without the trailing directory separator.
 	/// @note
 	/// e.g. "/home/project/texture.tga/" -> "/home/project/texture.tga"

+ 0 - 14
engine/core/strings/path.h

@@ -17,20 +17,6 @@ namespace crown
 /// @ingroup Path
 namespace path
 {
-	/// Returns whether the path segment @a segment is valid.
-	/// @note
-	/// The rules for valid segments are as follows:
-	/// a) The empty string is not valid.
-	/// b) Any string containing the slash character ('/') is not valid.
-	/// c) Common notations for current ('.') and parent ('..') directory are forbidden.
-	/// d) Any string containing segment or device separator characters on the local file system,
-	/// such as the backslash ('\') and colon (':') on some file systems are not valid.
-	/// (Thanks org.eclipse.core.runtime for the documentation ;D).
-	bool is_valid_segment(const char* segment);
-
-	/// Returns whether @a path is valid.
-	bool is_valid_path(const char* path);
-
 	/// Returns whether the @a path is absolute.
 	bool is_absolute_path(const char* path);