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

Remere at users.sourceforge.net Remere at users.sourceforge.net
Mon Jun 15 04:14:11 CEST 2009


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

Log Message:
-----------
*Fixed extract gob operating on dirs instead of files.
*Changed compress_gob to output '<infile>.stk' instead of 'out.stk'
*Fixed bug with Filename::setExtension that prevented it from correctly changing the filename on some paths.

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 01:32:56 UTC (rev 41531)
+++ tools/branches/gsoc2009-gui/compress_gob.cpp	2009-06-15 02:14:11 UTC (rev 41532)
@@ -72,13 +72,18 @@
 	if(last_arg - first_arg != 0)
 		error("Expected only one input file");
 
+	inpath.setFullPath(argv[first_arg]);
+
+	// We output with .stk extension, if there is no specific out file
+	if(outpath.empty()) {
+		outpath = inpath;
+		outpath.setExtension(".stk");
+	}
+
 	// Open input (config) file
-	if (!(gobConf = fopen(argv[first_arg], "r")))
-		error("Couldn't open conf file '%s'", argv[first_arg]);
+	if (!(gobConf = fopen(inpath.getFullPath(), "r")))
+		error("Couldn't open conf file '%s'", inpath.getFullPath());
 
-	// We output with .stk extension
-	outpath.setExtension(".stk");
-
 	// Open output filk
 	if (!(stk = fopen(outpath.getFullPath(), "wb")))
 		error("Couldn't create file \"%s\"", outpath.getFullPath());

Modified: tools/branches/gsoc2009-gui/extract_gob_stk.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_gob_stk.cpp	2009-06-15 01:32:56 UTC (rev 41531)
+++ tools/branches/gsoc2009-gui/extract_gob_stk.cpp	2009-06-15 02:14:11 UTC (rev 41532)
@@ -59,13 +59,10 @@
 	
 	// Continuing with finding out output directory
 	// also make sure we skip those arguments
-	if (parseOutputDirectoryArguments(&outpath, argv, argc, first_arg))
+	if (parseOutputFileArguments(&outpath, argv, argc, first_arg))
 		first_arg += 2;
-	else if (parseOutputDirectoryArguments(&outpath, argv, argc, last_arg - 2))
+	else if (parseOutputFileArguments(&outpath, argv, argc, last_arg - 2))
 		last_arg -= 2;
-	else
-		// Standard output dir
-		outpath.setFullPath("out/");
 
 	// We only got one input file
 	if (last_arg != first_arg)
@@ -73,6 +70,11 @@
 
 	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());
 

Modified: tools/branches/gsoc2009-gui/util.cpp
===================================================================
--- tools/branches/gsoc2009-gui/util.cpp	2009-06-15 01:32:56 UTC (rev 41531)
+++ tools/branches/gsoc2009-gui/util.cpp	2009-06-15 02:14:11 UTC (rev 41532)
@@ -180,7 +180,7 @@
 void Filename::setExtension(const char *ext) {
 	char *dot = strrchr(_path, '.');
 	if(!dot)
-		dot = _path + strlen(_path);
+		dot = _path + strlen(_path) - 1;
 	// Don't copy the dot
 	if(*ext == '.')
 		ext++;


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