PDA

View Full Version : _SourceFolder bug?



kraigyb
12-03-2003, 12:16 PM
I'm trying to use _SourceFolder in my application. When I preview the application or use the executable published for a Hard Drive Folder, _SourceFolder returns the the correct path of the executable. However, when I use the compressed executable, _SourceFolder returns the path of the uncompressed executable in the temp folder. Shouldn't it return the path of the original compressed executable?

thanks,
craig

Brett
12-03-2003, 12:23 PM
No. That is the designed behavior. _SourceFolder is always where the actual autorun.exe is being run from, not the SFX file. Otherwise all of the paths would be wrong in your app. The _SourceFolder makes it so that whether the app is run from a CD, a folder, or a SFX your application will work as expected.

However, you bring up a good point. I am going to make a variable that tells you the source of the self-extracting executable as well.

kraigyb
12-03-2003, 12:47 PM
Thanks, that would be great! I'm trying to call applications located in the same path as the original SFX file.

Why you would need the path to the extracted autorun.exe?

-craig

Brett
12-03-2003, 01:00 PM
Because when you use the design environment everything is relative to the location of the autorun.exe. It does not know that you are going to choose to publish to an SFX file later. Therefore it assumes that _SourceFolder is the location of the autorun.exe. You see the SFX file is really just a delivery method. AMS50 is made in such a way that it does not need to know how it will be distributed.

For example, you could use something like Setup Factory 6.0 to package and install your autoplay app. In that case you would still want _SourceFolder to be the location of the autorun.exe, not where the setup.exe that installs the app is run from.

Brett
12-04-2003, 09:17 AM
Hey, I went in to add that variable today for the source folder of the SFX executable and realized that it has already been addressed (I love it when that happens).

What happens is that the launcher passes a command line argument to the autorun.exe that tells it the folder it was launched from. The command line option is:

SFXSOURCE:<<Full Path and Filename>>

You can get this from your scripts by using the global _CommandLineArgs table. Try this:


if(_CommandLineArgs[1]) then
Dialog.Message("Arg1",_CommandLineArgs[1]);
end

From there you can use the String actions to parse out the folder name.