Skip to content

maktaba#path#Split should preserve trailing slash #137

@dbarnett

Description

@dbarnett

A trailing slash on the input to maktaba#path#Split is treated the same way as input without a trailing slasht. The last path component in the returned list of components will have no trailing slash either way:

echo maktaba#path#Split('foo/bar/')

['foo', 'bar']

Maktaba should try to preserve trailing slashes in path manipulations since they help distinguish paths that represent a directory from paths that may represent a file. For instance, Join(Split(X)) loses the trailing slash:

echo maktaba#path#Join(maktaba#path#Split('foo/bar/'))

foo/bar

Instead, Split should maintain the slash in the last component:

echo maktaba#path#Split('foo/bar/')

['foo', 'bar/']
It could instead include the empty string as a final component, but I don't think that's as self-explanatory.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions