Thursday, April 16, 2009

Making debugging a bit easier on Windows

In 2008r2 the compiler was altered so that it will create both an exe and a directory to hold the dlls if needed for Windows applications. When this happens, it puts the whole thing in a directory.

One of the difficulties with this has been that when you put your support files in that directory, the directory gets removed when your debug session ends and your support files are gone along with it.

You can use Run Paused to give yourself time to copy things to the directory created to hold your application. Or, you could use an IDE script to copy files into that directory every time you run.

A third option is to make it so RB never deletes the directory until you want it to.
How ?
Debug your application.
When REALbasic creates the directory where your debug app will go create a new text file in there. I call mine LOCK FILE just so I know what it is. There does not need to be anything in it. Change it's properties to "READ ONLY"

Now when REALbasic quits it will not delete the directory.
So that's one step down.

If you have a bunch of files that your application relies on to run properly, put them in the directory and also mark them "READ ONLY" - THIS IS VERY IMPORTANT because REALbasic will remove anything NOT marked read only AND because your application should NOT modify anything in the locations where the application is installed anyways as you or your end user may not have privileges to do so. Marking all these items read only makes it so that IF you try to write to one you should get an error of some kind.

That's it. Set this up the first time you debug and keep moving files in that you need and making them read only.

Thanks to Daniel Taylor on the NUG for the idea 


Anonymous said...

It's this kind of fairly ridiculous hoop jumping which is keeping me at 2007r5, even though I have a full Pro (now studio) license renewed out until 2011.

I do appreciate the information, and I'm sure people who have bitten the bullet and switched to the newer revisions are going to find this useful... but the Windows build process really needs to be fixed so this sort of stuff isn't necessary.

Anonymous said...

Much better to publish a solid workaround than not say anything. It's easy to do and it works. There is something to be said for testing this way, since a well done application would never write anything to its executing location- but I don't think it has to stay this way.

I completely understand the folder layout given the multi-platform builds. That's not the issue to me. I think just having RB only remove and/or replace the files it creates [and not the entire structure] each build is the smart way to go in the future. Then we can just drop files in there and be done. No read-only flags to set, etc.

Anonymous said...

Is this behavior discussed in the Release Notes or any elements of the 9.2 documentation?

Seems important enough.

Anonymous said...

I agree that the hoop jumping is pretty ridiculous. Maybe REALSoftware can find a way to make things way easier on their customers by changing the way REALBasic compiles so that we can have complete control over the build paths and make an option to *not* delete the paths when finished by overwriting anything that's in the path with the new build.

OR post the details of the build process and explain why it can't be done.. Then let customers make suggestions on how the build process should work. If RS can't figure a way, I'm sure its customers can offer suggestions.

Steve Garman said...

Norm, I realize that when you post a helpful workaround to a problem, it must be irritating to get a load of comments about hoop-jumping.
I hope this won't discourage you from making this kind of very useful post in the future.
Some of us definitely appreciate the advice, however much we may hope for changes in future deletion policy.

Craig Boyd said...

I have been working 80 hour weeks for over a month at my "day" job so I am little behind in my RB reading. Please keep this information coming!!! It is great to know how these things work and how to get around them. Since I do most of my development on Windows this has been a bit vexing for me.