[Scummvm-cvs-logs] SF.net SVN: scummvm: [27898] scummex/branches/gsoc2007-gameresbrowser

zbychs at users.sourceforge.net zbychs at users.sourceforge.net
Wed Jul 4 15:15:05 CEST 2007


Revision: 27898
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27898&view=rev
Author:   zbychs
Date:     2007-07-04 06:15:03 -0700 (Wed, 04 Jul 2007)

Log Message:
-----------
Using wxFileSystem. Minor fixes.

Modified Paths:
--------------
    scummex/branches/gsoc2007-gameresbrowser/src/core/ochain.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/gui/Test1.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/Directories.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/Directories.h
    scummex/branches/gsoc2007-gameresbrowser/vc8/Browser/Browser.vcproj

Added Paths:
-----------
    scummex/branches/gsoc2007-gameresbrowser/src/data/dummy.txt
    scummex/branches/gsoc2007-gameresbrowser/src/data/other.xxx
    scummex/branches/gsoc2007-gameresbrowser/src/data/subdir/
    scummex/branches/gsoc2007-gameresbrowser/src/data/subdir/dummy2.txt

Property Changed:
----------------
    scummex/branches/gsoc2007-gameresbrowser/src/data/

Modified: scummex/branches/gsoc2007-gameresbrowser/src/core/ochain.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/core/ochain.cpp	2007-07-04 11:17:37 UTC (rev 27897)
+++ scummex/branches/gsoc2007-gameresbrowser/src/core/ochain.cpp	2007-07-04 13:15:03 UTC (rev 27898)
@@ -236,7 +236,8 @@
 bool ObjectChain::realize() {
 	ordered_objs objs;
 	order_back_to_front(objs);
-	ordered_objs::const_reverse_iterator i;
+	//ordered_objs::const_reverse_iterator i;
+	ordered_objs::reverse_iterator i;
 
 	bool res = true;
 	for (i = objs.rbegin(); i != objs.rend(); ++i) {
@@ -311,7 +312,8 @@
 void ObjectChain::complete() {
 	PinSlotDesc* desc;
 	ordered_objs objs;
-	ordered_objs::const_reverse_iterator i;
+	//ordered_objs::const_reverse_iterator i;
+	ordered_objs::reverse_iterator i;
 
 	std::cout << "--- ObjectChain::complete() ---" << std::endl;
 	std::cout << "--- PINS ---" << std::endl;
@@ -327,7 +329,8 @@
 			continue; //every pin is connected
 
 		//try to find existing object
-		ordered_objs::const_reverse_iterator j;
+		//ordered_objs::const_reverse_iterator j;
+		ordered_objs::reverse_iterator j;
 		for (j = objs.rbegin(); j != objs.rend(); ++j) {
 			BObject* obj1 = *j;
 			if (obj1 == obj0)
@@ -385,7 +388,8 @@
 			continue; //every slot is connected
 
 		//try to find existing object
-		ordered_objs::const_reverse_iterator j;
+		//ordered_objs::const_reverse_iterator j;
+		ordered_objs::reverse_iterator j;
 		for (j = objs.rbegin(); j != objs.rend(); ++j) {
 			BObject* obj1 = *j;
 			if (obj1 == obj0)


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/data
___________________________________________________________________
Name: svn:ignore
   + pspbrwse.jbf
*.bak


Added: scummex/branches/gsoc2007-gameresbrowser/src/data/dummy.txt
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/data/dummy.txt	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/data/dummy.txt	2007-07-04 13:15:03 UTC (rev 27898)
@@ -0,0 +1,3 @@
+This is a dummy text file.
+
+Cheers.


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/data/dummy.txt
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: scummex/branches/gsoc2007-gameresbrowser/src/data/other.xxx
===================================================================
(Binary files differ)


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/data/other.xxx
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: scummex/branches/gsoc2007-gameresbrowser/src/data/subdir/dummy2.txt
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/data/subdir/dummy2.txt	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/data/subdir/dummy2.txt	2007-07-04 13:15:03 UTC (rev 27898)
@@ -0,0 +1,3 @@
+This is another dummy text file.
+
+Cheers.


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/data/subdir/dummy2.txt
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/Test1.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/Test1.cpp	2007-07-04 11:17:37 UTC (rev 27897)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/Test1.cpp	2007-07-04 13:15:03 UTC (rev 27898)
@@ -15,6 +15,8 @@
 
 #include "MainForm.h"
 
+#include "wx/filename.h"
+
 #include "plugin.h"
 #include "oregistry.h"
 
@@ -65,11 +67,21 @@
 		new VirtualNodeItemData( rootDir.get() ) );
 
 
+	wxFileName doll(_T("data"), _T("lalka.bmp"));
+	wxFileName dog(_T("data"), _T("pies.bmp"));
+	wxFileName foxes(_T("data"), _T("lisy.bmp"));
+
 	rootDir->addSubDir("data", "data");
-	rootDir->addFile("Doll", "data" NATIVE_SLASH "lalka.bmp");
-	rootDir->addFile("Dog", "data" NATIVE_SLASH "pies.bmp");
-	rootDir->addFile("Foxes", "data" NATIVE_SLASH "lisy.bmp");
 
+	if (doll.IsOk() && doll.FileExists() && doll.IsFileReadable())
+		rootDir->addFile("Doll", doll.GetFullPath().c_str());
+
+	if (dog.IsOk() && dog.FileExists() && dog.IsFileReadable())
+		rootDir->addFile("Dog", dog.GetFullPath().c_str());
+
+	if (foxes.IsOk() && foxes.FileExists() && foxes.IsFileReadable())
+		rootDir->addFile("Foxes", foxes.GetFullPath().c_str());
+
 	ObjectRegistry::get()->registerPlugin( &getTest1Plugin, true );
 
 	ObjectChain* rootChain = ExplorationTree::get()->getRootObjectChain();

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/Directories.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/Directories.cpp	2007-07-04 11:17:37 UTC (rev 27897)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/Directories.cpp	2007-07-04 13:15:03 UTC (rev 27898)
@@ -11,11 +11,8 @@
 
 #include <stdlib.h>
 
-#ifdef _MSC_VER
-	#include <io.h>
-#else
-	#include <dirent.h>
-#endif
+#include "wx/filesys.h"
+#include "wx/filename.h"
 
 #include "debugmem.h"
 
@@ -144,52 +141,37 @@
 	if (_created)
 		return;
 
-#ifdef _MSC_VER
-
-	std::string match = _directoryPath + NATIVE_SLASH + "*";
-	struct _finddata_t c_file;
-	intptr_t hFile = _findfirst( match.c_str(), &c_file );
-
-	if (hFile == -1L ) {
-		std::cout << "IDiskDirectoryImpl::create(): no files" << std::endl;
+	wxFileName dir = wxFileName::DirName( wxString(_directoryPath.c_str(), wxConvUTF8) );
+	if ( !(dir.IsOk() && dir.DirExists() && dir.IsDirReadable()) ) {
+		std::cout << "IDiskDirectoryImpl::create(): unreadable dir: " << dir.GetPath() << std::endl;
 		return;
 	}
 
-	do {
-		bool isDir = !!(c_file.attrib & _A_SUBDIR);
-		std::string fullpath = _directoryPath + NATIVE_SLASH + c_file.name;
-		if (isDir)
-			addSubDir(c_file.name, fullpath);
-		else
-			addFile(c_file.name, fullpath);
-	} while( _findnext( hFile, &c_file ) == 0 );
-	_findclose( hFile );
+	wxFileSystem fs;
+	fs.ChangePathTo(dir.GetPath(), true);
 
-#else
-	#ifndef _DIRENT_HAVE_D_TYPE
-		#error Must have dirent.d_type field.
-		%^*&()(
-	#endif
+	wxString found;
+	
+	found = fs.FindFirst(_T("*"), wxFILE);
+	while (!found.IsEmpty()) {
+		//wxFileName fname(dir.GetPath(), found);
+		wxFileName fname(found);
+		wxString dispName = fname.GetFullName();
+		addFile(dispName.c_str(), fname.GetFullPath().c_str());
+		found = fs.FindNext();
+	}
 
-	DIR *DirectoryPointer;
-	DirectoryPointer = opendir( _directoryPath.c_str() );
-	while(true) {
-		dirent* dp = readdir(DirectoryPointer);
-		if (dp == NULL)
-			break;
-		std::string fullpath = _directoryPath + NATIVE_SLASH + dp->d_name;
-		std::cout << "IDiskDirectoryImpl::create(): d_name " << dp->d_name << std::endl;
-		std::cout << "IDiskDirectoryImpl::create(): d_type " << (int)(dp->d_type) << " DT_REG = " << DT_REG << " DT_DIR = " << DT_DIR << std::endl;
-		if (dp->d_type == DT_DIR)
-			addSubDir(dp->d_name, fullpath);
-		else
-		if (dp->d_type == DT_REG)
-			addFile(dp->d_name, fullpath);
+	found = fs.FindFirst(_T("*"), wxDIR);
+	while (!found.IsEmpty()) {
+		//wxFileName fname(dir);
+		//fname.AppendDir(found);
+		wxFileName fname = wxFileName::DirName(found);
+		wxArrayString dirs = fname.GetDirs();
+		wxString dispName = dirs.Last();
+		addSubDir(dispName.c_str(), fname.GetPath().c_str());
+		found = fs.FindNext();
 	}
-	closedir(DirectoryPointer);
 
-#endif
-
 	IDirectoryImpl::create();
 }
 

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/Directories.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/Directories.h	2007-07-04 11:17:37 UTC (rev 27897)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/Directories.h	2007-07-04 13:15:03 UTC (rev 27898)
@@ -13,15 +13,6 @@
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef _WIN32
-	#define NATIVE_SLASH "\\"
-#else
-	#define NATIVE_SLASH "/"
-#endif
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
 class IDirectoryImpl;
 class IDiskDirectoryImpl;
 

Modified: scummex/branches/gsoc2007-gameresbrowser/vc8/Browser/Browser.vcproj
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/vc8/Browser/Browser.vcproj	2007-07-04 11:17:37 UTC (rev 27897)
+++ scummex/branches/gsoc2007-gameresbrowser/vc8/Browser/Browser.vcproj	2007-07-04 13:15:03 UTC (rev 27898)
@@ -91,7 +91,7 @@
 			/>
 			<Tool
 				Name="VCPostBuildEventTool"
-				CommandLine="xcopy ..\..\src\data ..\debug\data /i /y"
+				CommandLine="xcopy ..\..\src\data ..\debug\data /i /y /e"
 			/>
 		</Configuration>
 		<Configuration


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