SplitPath should probably be replaced with a path object

Discuss the future of the AutoHotkey language
iseahound
Posts: 1461
Joined: 13 Aug 2016, 21:04
Contact:

SplitPath should probably be replaced with a path object

13 Jul 2023, 16:17

I think in answer to the long standing question of what to do with SplitPath, it might be best to replace it with a simple path object.

For example,

Code: Select all

drive := Path("C:/Windows").drive
SplitPath should coexist with Path.

jeeswg's approach https://github.com/AutoHotkey/AutoHotkey/pull/296
just me
Posts: 9555
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: SplitPath should probably be replaced with a path object

14 Jul 2023, 03:06

As jeeswg's pull request shows, we don't need an additional function. SplitPath(Path) could return a path object, if all output parameters are omitted:

Code: Select all

drive := SplitPath("C:/Windows").drive
iseahound
Posts: 1461
Joined: 13 Aug 2016, 21:04
Contact:

Re: SplitPath should probably be replaced with a path object

14 Jul 2023, 10:22

No, I am suggesting an additional class while leaving SplitPath as-is. There are more properties that could be added such as .parent, the short 8.3 filename, and more. In addition, if operator overloading is added, the division operator / could be used for paths like in other languages.

Return to “AutoHotkey Development”

Who is online

Users browsing this forum: No registered users and 13 guests