User forums > Using Code::Blocks

Runtime environment variables

<< < (2/2)

BlueHazzard:

--- Quote ---It's not a great design decision to depend on the current working directory to find files your application depends on, this forces the user to be in that directory at application startup, so this would fail if e.g. your application is in the system path and gets started from a random directory.
--- End quote ---
I would like to add that it is also bad design if you do not report errors about file loading or file not found to the user.

planodan:
Thanks for the replies, and good points.  sodev hit on the problem in that it is the setting for "Execution working dir".  I have been leaving it as the default setting of "." for relative current dir.  Again, I made a bad assumption as to "relative to what?" which I thought was relative to the Objects output dir - which in my case ends in "...\objc\Debug" - i.e. I thought it was relative to where the program is located.  When I set it to include the same path - ..\..\objc\Debug - then everything works fine.  Totally my misunderstanding of how the path settings work.

As to the bad design comments, I totally agree with them, if the interpretation of my description were the way things were designed or being performed.  However, you don't have the full details of the design as I was trying to be as brief as possible to make the point that I was doing something extra by manually setting the envrn vars in a single program in an effort to troubleshoot the problem, not explain the complete design of the application's pathing details.  Obviously, I didn't make my point very well.  I further confused things with some bad wording in my effort to be brief.  When I said "look in the current directory" I did not mean the user's current directory.  It is the current directory for the application programs, or installed directory, as indicated in the Target setting for the application's icon on the Start Menu and/or desktop icon.  Sorry for the confusion.  As with any well designed app, the user can run the app from anywhere.  The app is not dependent on or relative to the user's location.

I think CB is a great product, and would have continued to think that even had my perceived problem been a real problem, and I'm glad to see that it does work the way I would have thought it should, and that it was my lack of knowledge or misunderstanding, not a lack of product features.  Now I'm smarter, so today is a success.  Thanks again!

Navigation

[0] Message Index

[*] Previous page

Go to full version