PDA

View Full Version : Path?



NewsArchive
03-24-2006, 09:57 AM
Simple little C6.1 app, uses an .INI file for basic configuration. .INI
location is set in Global properties to be in app directory.

Works fine in normal use.

But if I do a checkbox on the last screen of an SB5 installer to run the
program when the installer exits, for that first run my program gets its
path from the folder from which the SB5 installer was launched, rather than
the program's own directory.

I.e., if I do Stop(path()) at the start of my program, when launched from
the last installer wizard screen I get
d:\setup\timersetup
rather than
d:\program files\blah blah blah

Any suggestions on how I can fix this... either in my SB5 script or in the
Clarion code?

TIA

Jane

NewsArchive
03-24-2006, 09:57 AM
Jane,

Did you set the Default Directory (Run Program dialog)? By default,
it points to the %_SB_INSTALLDIR%.

HTH,

Friedrich

--
Friedrich Linder
CEO, Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 5

NewsArchive
03-25-2006, 04:28 AM
Friedrich,
That did it! I had "Target Folder" set correctly, but not "Default
Directory"
Thank you!

Jane

NewsArchive
03-25-2006, 04:28 AM
Jane,

Great, thank you.

Friedrich

NewsArchive
03-25-2006, 04:28 AM
Hi Jane,

>But if I do a checkbox on the last screen of an SB5 installer to run the
>program when the installer exits, for that first run my program gets its
>path from the folder from which the SB5 installer was launched, rather than
>the program's own directory.

You can get the path of the running program by using the Command(0)
and strip the path out (I always use fnsplit for that kind of stuff)

ITCoreClass.Construct Procedure
Code
SELF.EXEName = COMMAND('0')
SELF.ProgPath = SELF.GetFilePart(SELF.EXEName,FNS_Drive+FNS_Path)
SELF.ProgramCommandLine = COMMAND('')

Best regards,

Arnór Baldvinsson
Icetips Software
San Antonio, Texas, USA
www.icetips.com


Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php

NewsArchive
03-25-2006, 04:29 AM
Thanks, Arnor. I do use various permutations of command() and the fnsplit
call.
In this case, on first run the Clarion inimgr was looking for the file in
the folder from which the SB installer was run, rather than in its own
program directory. Friedrich's solution is a lot easier and more elegant
than would be trying to nudge inimgr in my direction...

Thanks, both, for the suggestions :)

Jane

NewsArchive
03-25-2006, 04:29 AM
Hi Jane,

>In this case, on first run the Clarion inimgr was looking for the file in
>the folder from which the SB installer was run, rather than in its own
>program directory. Friedrich's solution is a lot easier and more elegant
>than would be trying to nudge inimgr in my direction...

Remember that there are other situations where the current path may
change, for example if a user sets up a different "Start in" folder
for a shortcut. I try to stay on the safe side by specifying what
path files go into and I try not to rely on the current path unless I
know it's ok. So if you _must_ have the ini file with the exe, then
you need to take care of that in the program as situations may occur
where the program thinks it's starting up in a different directory.

All you need to do is change the "INI File to use" from
"ProgramName.INI" to "Other" and provide a global variable, like:

!Glo:IniFileName

Then in the "After PROGRAM Code Statement" global embed construct the
path and ini filename to use and you are good to go:)

Best regards,

Arnór Baldvinsson
Icetips Software
San Antonio, Texas, USA
www.icetips.com


Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php

NewsArchive
03-25-2006, 04:29 AM
Good advice. Thanks :)

Jane