Hi everyone,

I'm currently repackaging an application that requires "short" pathnames in some of its ini-files. It's a requirement to have this work on different language OS versions and thus hardcoding these paths is not doable.

I've tried using the SHORTFILENAMES-property to set a short filename variant of INSTALLDIR .. like this:

  • In a non-deffered CA, sat SHORTFILENAMES=TRUE
  • Another CA setting INSTALLDIRSHORT to the value of INSTALLDIR
  • Last CA reverting SHORTFILENAMES back to false.

This isn't working, the value of INSTALLDIRSHORT after the last CA is in the long format. Probably I'm missing something or I don't understand how this is supposed to work. Is there any way of easily populating a property with the short filename of INSTALLDIR?
0 Comments   [ + ] Show Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.


Have you tried using [!PrimaryKeyForFileInFileTable]?

From the SDK:
If a substring of the form [!filekey] is found, it is replaced by the full short path of the file, with the value filekey used as a key into the File table.
Answered 06/07/2007 by: AngelD
Red Belt

Please log in to comment
Yeah, I looked up that one, trouble was, I needed the directory path, not the full file path. But I could probably just create a dummy entry in the File table that never gets installed, and reference that. The dummy file would then need to have the same short pathname as the directory that WILL be installed. Should work.

Thanks for getting me to rethink that.

Right now I solve this by conditionally installing different INI-entries based on the reported language. Works but doesn't scale to unknown languages :-)
Answered 06/07/2007 by: deploy.no
Orange Belt

Please log in to comment
You could always author a custom action that reads in the file path and then parse out the file part which you then set another property to hold.

Something like this:
Dim FilePath, Directory
FilePath = MsiGetFilePath("MyFile.txt")
Directory = Mid(FilePath, 1, InStrRev(FilePath, "\")) '// end with a trailing \
'// Directory = Mid(FilePath, 1, InStrRev(FilePath, "\")-1) '// does not end with a trailing \
Session.Property("MyProperty") = Directory

Function MsiGetFilePath(File)
Dim Database, Record, View, FileRecord

Set Database = Session.Database
Set Record = Session.Installer.CreateRecord(0)

Set View = Database.OpenView("SELECT * FROM `File` WHERE `File` = '" & File & "'")

Set FileRecord = View.Fetch
If (FileRecord Is Nothing) Then
MsiGetFilePath = ""
Exit Function
End If

Record.StringData(0) = "[!" & FileRecord.StringData(1) & "]"
MsiGetFilePath = Session.FormatRecord(Record)
End Function
Answered 06/07/2007 by: AngelD
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity