cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

shortcut trailing \ in work dir

hi all,

i have a shortcut with a working directory d:\apps\cwinII\

i do not want it to append the trailing \ as it is a 16 bit app and this causes problems. The shortcut working dir in developer is set to [INSTALLDIR] and i install the msi with :
msiexec.exe /i "path + msi.msi" /qr INSTALLPATH="D:\Apps\CWINII"

it creates the shortcut and gives it the value
D:\Apps\CWINII\"

the last \ causes the program not to function as it is hardcoded into the dll search path (16bit apps really suck) so the search path ends up being:
D:\Apps\CWINII\\DLLS

HELP!!! do i have to hard write the shortcut values?
(11) Replies
For one approach to removing the final backslash, please see InstallShield KB article Q106587, at http://support.installshield.com/kb.
problem being these are pure MSI packages, no installshield EXE file. no vbs and no ISCRIPT. I have to deploy them via ADS. Have i misunderstood this? i thought you couldnt include scripting with MSI packages?

Okay scrub that. I am looking at custom action, installshield script. i cannot create a function though? How do i do this without an installshield setup.exe? i can't seem to create .rul files.
OK WISH LIST:

GIMME A SIMPLE BUTTON THAT SAYS \ on end yes/no!!!!!

can't be that hard can it? and certainly not as hard as learning vbscript in an afternoon!!!!!!!!!!! and it still doesn't do it...

error 1720 script can't be run?? does someone have simply the finished article i can add as a custom action please..copy and paste type thing.

BTW good book Mr Dickau 🙂
Alas, MSI does insist on trailing backslashes for properties in the Directory table...

But here's a copy-and-paste custom action that will set a property to a Directory value minus the trailing backslash; you can then use the form [INSTALLDIRWITHOUTSLASH] in MSI fields that use the Formatted data type (such as many fields of the Registry and IniFile fields).

(Examples of inserting custom actions in a database are covered in Chapters 8 and 16, since --- thanks! --- you have a copy of the book...)

[code]' since the function uses Directory properties,
' schedule for immediate mode,
' in Execute sequence after CostFinalize;
' VBScript action type, function name RemoveLastSlash, ...

Function RemoveLastSlash( )

' TO DO: replace INSTALLDIR with your desired property
pathOrig = Property("INSTALLDIR")

If (Right(pathOrig, 1) = "\") Then

pathWithoutSlash = Left(pathOrig, Len(pathOrig) - 1)

Else ' do nothing

pathWithoutSlash = pathOrig

End If

' create a property that you can use in the Registry
' views as [INSTALLDIRWITHOUTSLASH]...
Property("INSTALLDIRWITHOUTSLASH") = pathWithoutSlash

RemoveLastSlash = 1 ' return success to MSI

End Function[/code]

P.S. If you want to use [INSTALLDIRWITHOUTSLASH] as a shortcut's working directory, you'll need to add a dummy INSTALLDIRWITHOUTSLASH record to the Directory table...
Thanks loads. Much appreciated.

OK. i am having a twat attack.

I have inserted the vbscript. It runs. I can use the [INSTALLDIRWITHOUTSLASH] property in the registry.

er what exactly is a dummy record?

I have tried to create in the directory table: INSTALLDIRWITHOUTSLASH

Directory_Parent is set to the same as [INSTALLDIR]

Defaultdir is set to .

This doesn't work. I have tried setting both values to INSTALLDIRWITHOUTSLASH. no go.

I have tried leaving blank after first. Won'T let me select it. Sorry about this, but i have only started to learn scripting and that kinda thing about a week ago...

You're on the right path: by "dummy record", I just meant a placeholder record to store the data set by the custom action.

In my test, my Directory-table record was:

Directory: INSTALLDIRWITHOUTSLASH
Directory_Parent: INSTALLDIR [no brackets]
DefaultDir: DeleteMe

Then, in the Shortcut table, set the WkDir field to INSTALLDIRWITHOUTSLASH, again with no brackets...
ahhhh..no brackets 🙂

i kept getting network location not found errors. ok will try that again tomorrow. have just finished reading chapter 8...have now a headache.
OK i am gonna become a pig farmer or something.

What am i missing??? If i set it as said, when i try and give the INSTALLDIRWITHOUTSLASH (without brackets) as WkDir it says invalid path. If i do it with brackets it works, but the value doesn't get updated at runtime. I have tried creating a property manager thing with INSTALLDIR (otherwise i can't select anything. what have i missed? I have tried everything i can think of and it does still not work right. Am i not executing the vbscript right? is the value set wrong? I cannot work this one out, and it is a problem as i have about 35 old apps that we must still use (politics) and they all have this problem!!!

I have attatched the ism. can someone see what i have missed? or done wrong or anything!!!!!!
Luckyly there are no specific secondary educational requirements for pig farmers.

Taking INSTALLDIRWITHOUTSLASH out of the proprerty table will get rid of the 1606 errors.

As for the path; it's seems to me that the value being used is always the one in the Directory-table. Since SetTargetPath will add a slash as well, I don't see how this can be done....

The SDK notes that the propertie is used, but I don't see how that is true.

Regards,



Rene
Well, attached is my sample project, along with a built MSI package (~185K), which seemed to work...

I fear the joys of pig farming shall forever remain foreign to me.
MUHAHAHAHAHA and various other sounds of victory 🙂


It seems only to work if i leave the vbscript as a seperate file and not as part of the binary table? i assume this is to do with accessing runtime variables and being able to change them outside of its own local definition area?

But basically the exact thing i did with it first, i have now set up again except for the vb file remaining a file. and now it works perfectly 🙂

Thanks loads for your help Mr Dickau.