Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maktaba#path#Split should preserve trailing slash #137

Closed
dbarnett opened this issue Mar 23, 2015 · 0 comments
Closed

maktaba#path#Split should preserve trailing slash #137

dbarnett opened this issue Mar 23, 2015 · 0 comments
Assignees
Labels

Comments

@dbarnett
Copy link
Contributor

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.

@dbarnett dbarnett added the bug label Mar 23, 2015
dbarnett added a commit that referenced this issue Apr 29, 2017
@dbarnett dbarnett self-assigned this Apr 29, 2017
dbarnett added a commit that referenced this issue Apr 29, 2017
Also improves maktaba#path#MakeRelative to preserve trailing slash and adds a maktaba#path#StripTrailingSlash().

Fixes #137 and #175.
dbarnett added a commit that referenced this issue May 8, 2017
Changes since 1.14.0:
  * Implement maktaba#buffer#GetVisualSelection helper (#132).
  * Implement maktaba#log#GetFormattedEntries and support 1-arg log
    handler (see #204).
  * Notify user for messages logged at WARN or above by default (#185).
  * Fix Syscall.CallAsync failing for complex commands (#205).
  * Preserve trailing slash in maktaba#path#Split and MakeRelative
    (#137 and #175).
  * Fix 'maxfuncdepth' error in maktaba#json#Parse corner case (#153).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant