[Scummvm-cvs-logs] SF.net SVN: scummvm: [22727] scummvm/trunk/backends/fs/psp/psp_fs.cpp

joostp at users.sourceforge.net joostp at users.sourceforge.net
Sun May 28 15:03:10 CEST 2006


Revision: 22727
Author:   joostp
Date:     2006-05-28 15:02:38 -0700 (Sun, 28 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22727&view=rev

Log Message:
-----------
fix PSPFilesystemNode::parent() + some minor cleanup

Modified Paths:
--------------
    scummvm/trunk/backends/fs/psp/psp_fs.cpp
Modified: scummvm/trunk/backends/fs/psp/psp_fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/psp/psp_fs.cpp	2006-05-28 21:35:35 UTC (rev 22726)
+++ scummvm/trunk/backends/fs/psp/psp_fs.cpp	2006-05-28 22:02:38 UTC (rev 22727)
@@ -31,7 +31,9 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
+#define	ROOT_PATH	"ms0:/"
 
+
 /*
  * Implementation of the ScummVM file system API based on PSPSDK API.
  */
@@ -41,7 +43,6 @@
 	String _displayName;
 	bool _isDirectory;
 	bool _isValid;
-	bool _isPseudoRoot;
 	String _path;
 	
 public:
@@ -70,8 +71,7 @@
 	_isDirectory = true;
 	_displayName = "Root";
 	_isValid = true;
-	_path = "ms0:/";
-	_isPseudoRoot = true;
+	_path = ROOT_PATH;
 }
 
 PSPFilesystemNode::PSPFilesystemNode(const Common::String &p, bool verify) {
@@ -110,7 +110,6 @@
 			PSPFilesystemNode entry;
             
 			entry._isValid = true;
-			entry._isPseudoRoot = false;
 			entry._displayName = dir.d_name;
 			entry._path = _path;
 			entry._path += dir.d_name;
@@ -146,20 +145,16 @@
 }
 
 AbstractFilesystemNode *PSPFilesystemNode::parent() const {
-	assert(_isValid || _isPseudoRoot);
-	if (_isPseudoRoot)
+	assert(_isValid);
+	
+	if (_path == ROOT_PATH)
 		return 0;
-	PSPFilesystemNode *p = new PSPFilesystemNode();
-	if (_path.size() > 5) {
-		const char *start = _path.c_str();
-		const char *end = lastPathComponent(_path);
-
-		p->_path = String(start, end - start);
-		p->_isValid = true;
-		p->_isDirectory = true;
-		p->_displayName = lastPathComponent(p->_path);
-		p->_isPseudoRoot = false;
-	}
+	
+	const char *start = _path.c_str();
+	const char *end = lastPathComponent(_path);
+	
+	PSPFilesystemNode *p = new PSPFilesystemNode(String(start, end - start), false);
+	
 	return p;
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list