SHORTFILENAMES-property useful for "converting" INSTALLDIR?
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:
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?
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
Answers (3)
Please log in to answer
Posted by:
AngelD
17 years ago
Posted by:
deploy.no
17 years ago
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 :-)
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 :-)
Posted by:
AngelD
17 years ago
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 & "'")
View.Execute
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
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 & "'")
View.Execute
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
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.