[Scummvm-cvs-logs] SF.net SVN: scummvm:[41547] tools/branches/gsoc2009-gui

Remere at users.sourceforge.net Remere at users.sourceforge.net
Mon Jun 15 16:24:39 CEST 2009


Revision: 41547
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41547&view=rev
Author:   Remere
Date:     2009-06-15 14:24:36 +0000 (Mon, 15 Jun 2009)

Log Message:
-----------
*compress_gob now accepts correct input (confused file and dir input before)

Modified Paths:
--------------
    tools/branches/gsoc2009-gui/compress_gob.cpp
    tools/branches/gsoc2009-gui/extract_gob_stk.cpp
    tools/branches/gsoc2009-gui/util.cpp

Modified: tools/branches/gsoc2009-gui/compress_gob.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_gob.cpp	2009-06-15 13:50:41 UTC (rev 41546)
+++ tools/branches/gsoc2009-gui/compress_gob.cpp	2009-06-15 14:24:36 UTC (rev 41547)
@@ -37,7 +37,7 @@
 
 Chunk *readChunkConf(FILE *gobconf, uint16 &chunkCount);
 void writeEmptyHeader(FILE *stk, uint16 chunkCount);
-void writeBody(FILE *stk, uint16 chunkcount, Chunk *chunks);
+void writeBody(Filename *inpath, FILE *stk, uint16 chunkcount, Chunk *chunks);
 uint32 writeBodyFile(FILE *stk, FILE *src);
 uint32 writeBodyPackFile(FILE *stk, FILE *src);
 void rewriteHeader(FILE *stk, uint16 chunkCount, Chunk *chunks);
@@ -94,7 +94,7 @@
 
 	// Output in compressed format
 	writeEmptyHeader (stk, chunkCount);
-	writeBody(stk, chunkCount, chunks);
+	writeBody(&inpath, stk, chunkCount, chunks);
 	rewriteHeader(stk, chunkCount, chunks);
 
 	// Cleanup
@@ -153,7 +153,7 @@
 	return;
 }
 
-void writeBody(FILE *stk, uint16 chunkCount, Chunk *chunks) {
+void writeBody(Filename *inpath, FILE *stk, uint16 chunkCount, Chunk *chunks) {
 	Chunk *curChunk = chunks;
 	FILE *src;
 	uint32 realSize;
@@ -162,8 +162,9 @@
 	uint32 tmpSize;
 
 	while(curChunk) {
-		if (!(src = fopen(curChunk->name, "rb")))
-			error("Couldn't open conf file \"%s\"", curChunk->name);
+		inpath->setFullName(curChunk->name);
+		if (!(src = fopen(inpath->getFullPath(), "rb")))
+			error("Couldn't open conf file \"%s\"", inpath->getFullPath());
 
 		realSize = fileSize(src);
 

Modified: tools/branches/gsoc2009-gui/extract_gob_stk.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_gob_stk.cpp	2009-06-15 13:50:41 UTC (rev 41546)
+++ tools/branches/gsoc2009-gui/extract_gob_stk.cpp	2009-06-15 14:24:36 UTC (rev 41547)
@@ -59,29 +59,28 @@
 	
 	// Continuing with finding out output directory
 	// also make sure we skip those arguments
-	if (parseOutputFileArguments(&outpath, argv, argc, first_arg))
+	if (parseOutputDirectoryArguments(&outpath, argv, argc, first_arg))
 		first_arg += 2;
-	else if (parseOutputFileArguments(&outpath, argv, argc, last_arg - 2))
+	else if (parseOutputDirectoryArguments(&outpath, argv, argc, last_arg - 2))
 		last_arg -= 2;
+	else
+		outpath.setFullPath("./");
 
+
 	// We only got one input file
 	if (last_arg != first_arg)
 		error("Only one input file expected!");
 
 	inpath.setFullPath(argv[first_arg]);
 
-	if(outpath.empty()) {
-		outpath = inpath;
-		outpath.setExtension(".stk");
-	}
-
 	if (!(stk = fopen(inpath.getFullPath(), "rb")))
 		error("Couldn't open file \"%s\"", inpath.getFullPath());
 
-	if (outpath.empty()) {
+	if (outpath.empty())
 		outpath = inpath;
-		outpath.setExtension(".gob");
-	}
+	else
+		outpath.setFullName(inpath.getFullName());
+	outpath.setExtension(".gob");
 
 	if (!(gobConf = fopen(outpath.getFullPath(), "w")))
 		error("Couldn't create config file \"%s\"", outpath.getFullPath());

Modified: tools/branches/gsoc2009-gui/util.cpp
===================================================================
--- tools/branches/gsoc2009-gui/util.cpp	2009-06-15 13:50:41 UTC (rev 41546)
+++ tools/branches/gsoc2009-gui/util.cpp	2009-06-15 14:24:36 UTC (rev 41547)
@@ -239,7 +239,8 @@
 		strcpy(out, slash + 1);
 		return out;
 	}
-	return NULL;
+	strcpy(out, _path);
+	return out;
 }
 
 const char *Filename::getFullName() const {
@@ -247,7 +248,7 @@
 	if ((slash = strrchr(_path, '/')) || (slash = strrchr(_path, '\\'))) {
 		return slash + 1;
 	}
-	return NULL;
+	return _path;
 }
 
 const char *Filename::getPath(char *out) const {


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