Archived

This topic is now archived and is closed to further replies.

Finding path/dir of program while running..

This topic is 6079 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m using InstallShield Express for my game..at the end, there''s a checkbox to launch the program after installation is complete..it launches the program, but doesn''t set the current directory to where the program actually is, so it crashes when it can''t find the data files.. I''ve gone through the docs for InstallShield Express, no help there.. I can''t assume that the user will pick the default installation folder, so no hardcoding.. The Add/Remove works, the shortcut on the start menu also works..it''s just that one-time-only-launch-after-install instance that''s killing me I know that there must be some way of determining where the currently running process is located in the directory structure..if I could find the path to the executable at run time when it loads, I could easily set it as the current directory from within the exe.. If I have to I could search the entire drive the first time it loads, find the exe, and save the path to a config file, but that''s not an elegant solution..actually, that just plain sucks.. BTW the game runs no matter where it''s installed, you can put it anywhere on your hard drive(s)..but the current directory MUST be the same as the exe or I can''t access the data files.. Does anyone have a way around this?..is there something in InstallShield Express that I''m not doing correctly? I will appreciate ANY solutions offered.. Thanks in advance- MM "Like all good things, it starts with a monkey.."

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I don''t think this is an InstallShield problem. Your program shouldn''t assume that it''s always going to be launched with the current directory set to the EXE''s path. I don''t know what development system you used to develop your game, but there is a function in the Win32 API called GetModuleFileName that you can use to get the full path and file name of the EXE. Then you can strip off the EXE name and use the path to either create fully qualified paths to your data files or use SetCurrentDirectory.

Share this post


Link to post
Share on other sites
I just found that right before I checked back..

I knew it wasn''t specifically an InstallShield problem, I was just hoping I could get out of Obscure Win32 Function Search mode

All is working now, thanks!!

"Like all good things, it starts with a monkey.."

Share this post


Link to post
Share on other sites