Re: [AD] Some points about the grabber

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2002-04-03, Evert Glebbeek <eglebbk@xxxxxxxxxx> wrote:
> For my projects, I store both my datafiles and source code on a Windows 
> partitition and access it in Linux through symlinks - this way, I can get 
> to the same files easily. 
> The problem is that the grabber destroys these symlinks for datafiles. An 
> example: say I have 
> 
>    sprites.dat -> /windows/d/program/game/sprites.dat
> 
> opening the datafile in the grabber works as expected, saving it 
> overwrites the symlink with a real file sprites.dat, which is very 
> annoying. I don't know enough about Linux programming to fix this 
> personally.

(*pssst* man realpath) 

I'm not sure if your intended behaviour is absolutely the Right Thing
to do though.

> Invoking the grabber with 
> 
>    grabber /windows/d/program/game/sprites.dat
> 
> gives the error message
> 
>    Invalid colordepth '/windows/d/program/game/sprites.dat'
> 
> I'll have a look at it, but if someone else feels like fixing it first...

This is due to using `/' for options.  One fix is attached, but that
won't handle filenames like "/32" (practically speaking, shrug).
Another way is to simply throw away `/' as an option character, but
some people might not be impressed (though `dat' only understands `-').

> Lastly, I'd like a change in the way the grabber stores the source for 
> datafile objects. Right now, it stores the absolute path. I'd like to 
> change it so that it stores the path relative to the datafile instead.

Yes!

> This will make it easier to update datafiles on a different platform than 
> where they were created, as well as make it less cumbersome when you move 
> everything to a different directory or partitition.
> Again, I'll look into this if no-one objects, but probably not before the 
> weekend.

SpeedHacking?
--- grabber.c.~1.27.~	Fri Mar  8 18:32:31 2002
+++ grabber.c	Thu Apr  4 11:06:00 2002
@@ -16,6 +16,7 @@
  */
 
 
+#include <ctype.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -3134,11 +3135,18 @@
 	    }
 	 }
 	 else {
-	    bpp = atoi(argv[i]+1);
-	    if ((bpp != 8) && (bpp != 15) && (bpp != 16) && (bpp != 24) && (bpp != 32)) {
-	       allegro_message("Invalid color depth '%s'\n", argv[i]+1);
-	       return 1;
+	    for (j = strlen(argv[i]+1); j > 0; j--)
+	       if (!isdigit(argv[i][j]))
+		  break;
+	    if (j == 0) {
+	       bpp = atoi(argv[i]+1);
+	       if ((bpp != 8) && (bpp != 15) && (bpp != 16) && (bpp != 24) && (bpp != 32)) {
+		  allegro_message("Invalid color depth '%s'\n", argv[i]+1);
+		  return 1;
+	       }
 	    }
+	    else
+	       fname = argv[i];
 	 }
       }
       else


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/