Page 1 of 1

API for getting application directory?

PostPosted: Aug 3, 2003 @ 4:42am
by mlepage
Using GapiDraw, it helpfully loads relative-path files from the application directory, when calling CGapiSurface::CreateSurface.

I would like to also load some of my data files from the application directory.

Is there a GapiDraw API that returns that directory for me, so I can load other files from there?

That would be best, since then I am sure whatever algorithm looks for the application directory for my image files, works the same for my other data files.

How do people normally do this?

PostPosted: Aug 3, 2003 @ 7:37pm
by efortier

OK

PostPosted: Aug 3, 2003 @ 10:17pm
by mlepage

PostPosted: Aug 3, 2003 @ 10:22pm
by Guest

It's not about laziness.

PostPosted: Aug 4, 2003 @ 1:59am
by mlepage

PostPosted: Aug 4, 2003 @ 2:09am
by fzammetti

PostPosted: Aug 4, 2003 @ 2:24am
by DillRye
Actually Anon was me, I too have the same problems where it looses my login as you do Fzam.

I am not hiding behind anything, but I often see posts demanding stuff of GapiDraw when it can be easily done by the person themself. Its not like coding the getPath instruction is more than 10 lines of code.

If someone cant handel "reinventing" 10 lines of code, they sure as heck should not be trying to make games. Why make a clone of a game, Its allready been done, and its reinventing the wheel?

I was just venting, since I constantly see posts about people begging SBL to impliment clipping and some various function that are absolutly trival. Now that clipping has been added, I will use it, but I didnt NEED it.

I also believe there becomes a point where you distance yourself soo far from the base code, that you dont even know what the hecks going on. I personally have written blitters, which do rotation/scaling and a few other various effects, but I choose to use GapiDraw since its such a wonderful feature set.

While I am abstracted with GapiDraw, I know whats going on at the base level. I dont think everyone needs to know, but when your complaning about a simple function that wont even take you a total of 5 min to impliment, I get a little miffed.

I entirely welcome questions, and creative thinking.

PostPosted: Aug 4, 2003 @ 2:50am
by fzammetti
Well, I had a feeling it was one of the regulars that lost their logon, good thing I didn't go off too much :) Ironically, that problem for me seems to have gone away. Don't ask how or why, I haven't the slightest clue!

Obviously my coward comment doesn't apply to you, that was on the chance that it wasn't a regular.

In any case, I agree with you to an extent. I'm like you it seems in that I tend to WANT to do things myself, if for no other reason than to know every detail of what's going on. I frankly have to fight myself at work all the time, where all I do is Java all day, to actually look through the class libraries and other sources of code before diving in and writing every little thing myself. It's a little different when your being paid to code I think, but it's still true outside work.

I think the original point, which I think is valid, is that since GD is doing this already, exposing the functionality probably isn't a big deal, and if it saves us five minutes and takes Johan 30 seconds to implement it, then it's not a bad request. I think it's obviously something that should fall to the bottom of the long list, but it's not a bad request.

I also agree with you that people DO tend to come here sometimes and complain about things and "request" things be added that aren't really important, relatively speaking. I totally understand your need to vent sometimes :) But I didn't think mlepage was complaining at all. Granted, he probably could have written the code in the time it took to read the replies and type his own :)

Ah, in any case, I have some code to write myself, and this isn't getting that done either I suppose ;)

Reexplaining

PostPosted: Aug 4, 2003 @ 4:46am
by mlepage
No worries guys. But let me explain the reasons again.

It's not laziness or inability. It's simple software engineering. Right now, I have two functions which attempt to do the same thing.

One function is mine, and seems to work as advertised. The other is hidden without an API, and doesn't seem to work as advertised by the documentation.

So these functions may differ in their results. In fact, I have found that they *do* differ in their results, when running my game from within Visual Studio.

So, I am risking putting my game in a position where it can find its configuration files, but not its image files, under some circumstances.

So, to properly manage this risk, I am forced to simply always use my function to obtain an absolute path, and always pass an absolute path into the GapiDraw image loading routines.

Don't you find it odd that I am forced to reimplement something that is in GapiDraw, and not use GapiDraw's version at all?

Now consider this: GapiDraw probably already has this API internally. It just needs to be exposed for our use. Then, I can remove my implementation of the same functionality. Then, even if that function somehow fails, at least my game is looking for everything in one place, and not two places.

I'm not asking for a feature that isn't already in GapiDraw. It's a low-hanging fruit. It probably only requires an entry in a header file.

It could be worse, I could be asking for const correctness. :-)

PostPosted: Aug 4, 2003 @ 5:30am
by efortier
jheez...

I use GetModuleFileName() in all my projects, and I never had a single problem. Not on the desktop, not on Toshiba or iPaqs, and not from running in Visual Studio or eVC.

If some of your files cannot be found when you run the application from VS, check where your .EXE is created. Move it to your root folder or something.

And DillRye is right, this function is short. Mine has 4 lines plus the final "return S_OK". It gets the module name and get rids of the filename.

This is not brain surgery, this is making a freaking function.

I can't believe I'm still writing...

--Eric

Functions

PostPosted: Aug 4, 2003 @ 6:23am
by mlepage

PostPosted: Aug 4, 2003 @ 7:41am
by maurice

PostPosted: Aug 4, 2003 @ 8:30am
by Johan

As suspected

PostPosted: Aug 4, 2003 @ 3:37pm
by mlepage