[Scummvm-cvs-logs] CVS: scummvm/backends/fs/posix posix-fs.cpp,1.10,1.11

Max Horn fingolfin at users.sourceforge.net
Tue Mar 25 04:15:13 CET 2003


Update of /cvsroot/scummvm/scummvm/backends/fs/posix
In directory sc8-pr-cvs1:/tmp/cvs-serv2331/posix

Modified Files:
	posix-fs.cpp 
Log Message:
default to current directory (instead of FS root)

Index: posix-fs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/fs/posix/posix-fs.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- posix-fs.cpp	6 Mar 2003 21:45:00 -0000	1.10
+++ posix-fs.cpp	25 Mar 2003 12:14:14 -0000	1.11
@@ -24,10 +24,12 @@
 
 #ifdef MACOSX
 #include <sys/types.h>
+#include <sys/param.h>
 #endif
 #include <sys/stat.h>
 #include <dirent.h>
 #include <stdio.h>
+#include <unistd.h>
 
 #ifdef __GP32__ //ph0x FIXME: implement and move to portdefs.h
 #define opendir(x) (0)
@@ -62,15 +64,35 @@
 };
 
 
+static const char *lastPathComponent(const ScummVM::String &str) {
+	const char *start = str.c_str();
+	const char *cur = start + str.size() - 2;
+	
+	while (cur > start && *cur != '/') {
+		--cur;
+	}
+	
+	return cur+1;
+}
+
 FilesystemNode *FilesystemNode::getRoot() {
 	return new POSIXFilesystemNode();
 }
 
 POSIXFilesystemNode::POSIXFilesystemNode() {
-	_displayName = "/";
+#if 1
+	char buf[MAXPATHLEN];
+	getwd(buf);
+	
+	_path = buf;
+	_displayName = lastPathComponent(_path);
+	_path += '/';
+#else
+	_path = "/";
+	_displayName = _path;
+#endif
 	_isValid = true;
 	_isDirectory = true;
-	_path = "/";
 }
 
 /*
@@ -127,17 +149,6 @@
 	}
 	closedir(dirp);
 	return myList;
-}
-
-const char *lastPathComponent(const ScummVM::String &str) {
-	const char *start = str.c_str();
-	const char *cur = start + str.size() - 2;
-	
-	while (cur > start && *cur != '/') {
-		--cur;
-	}
-	
-	return cur+1;
 }
 
 FilesystemNode *POSIXFilesystemNode::parent() const {





More information about the Scummvm-git-logs mailing list