Inno Setup缩短文件路径字符串以适合FilenameLabel [英] Inno Setup shorten file path string to fit FilenameLabel

查看:47
本文介绍了Inno Setup缩短文件路径字符串以适合FilenameLabel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WizardForm.InstallingPage上,WizardForm.FilenameLabel自动截断包含文件路径的字符串,以在开头包含驱动器号,然后是最大的可显示路径,从路径的顶层截断,以适合标签的大小,以便始终显示文件名,例如C:\...\LongFilePathNameWithMultipleSubDirectories\Filename.ext.

On the WizardForm.InstallingPage, the WizardForm.FilenameLabel automatically truncates the string containing the file path, to include the drive letter at the beginning, followed by the maximum displayable path, truncating from the top level of the path, to fit the size of the label, so that the file name is always shown e.g. C:\...\LongFilePathNameWithMultipleSubDirectories\Filename.ext.

我已经看过LengthPosCopyExtractFileDrive字符串函数,但是由于存在几乎无限数量的路径和文件名的可能性,因为用户可以选择它们的任何安装路径希望,我正在努力找到一种方法来显示路径的最大可能长度,而不会截断文件名.

I have looked at the Length, Pos, Copy and ExtractFileDrive String Functions, but given that there are an almost infinite number path and file name possibilities, as the user can choose any installation path they wish, I am struggling to work out a way to show the maximum possible length of the path, without truncating the file name.

我想我需要一个类似Pos的函数,该函数返回找到的每个\的匹配数和索引,这意味着我可以在每个索引之间使用Length来确定从Copy开始的位置,但我找不到任何方法.

I think I need a function like Pos that returns the number of matches and the index for every \ it finds, which would mean I could use Length between each index to determine where to Copy from, but I haven't been able to find any way of doing this.

推荐答案

MinimizePathName() 函数可用于脚本编写,它需要一个字符串&一种字体并返回经过重新格式化的字符串,该字符串将适合给定字体中给定数量的像素.

The MinimizePathName() function is available to scripting, it takes a string & a font and returns a reformatted string that will fit in a given number of pixels in the given font.

这篇关于Inno Setup缩短文件路径字符串以适合FilenameLabel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆