Inno Setup - Get a path to parent folder

2020-03-30 06:32发布

I need to get the parent folder of {app}. It's standard if the end user didn't change the default, but if he did, it becomes a little more problematic. Basically, I need a function, that will output everything till the last \ backslash (inclusive). Wanted to try Pos, but it only detects the first instance of the character.

1条回答
▲ chillily
2楼-- · 2020-03-30 06:39

Use the ExtractFilePath function:

Extracts the drive and directory parts of the given file name. The resulting string is the leftmost characters of FileName, up to and including the colon or backslash that separates the path information from the name and extension. The resulting string is empty if FileName contains no drive and directory parts.

查看更多
登录 后发表回答