dominikschnitzer / musly

Musly - Music Similarity Library
http://www.musly.org
Mozilla Public License 2.0
138 stars 26 forks source link

Fix issue 41: extra / in file paths when adding tracks #42

Open leihuayi opened 6 years ago

leihuayi commented 6 years ago

When using tab autocompletion for path/to/music/files, usually an extra "/" is added at the end, which corrupts the path of files in collection. I edited main.cpp in the action -a to remove the extra "/" if it exists.

f0k commented 6 years ago

Thanks! Seems like a good idea. However, for cleanliness, I would prefer this to be taken care of in fileiterator.cpp, before this line: https://github.com/dominikschnitzer/musly/blob/8003ea1/musly/fileiterator.cpp#L31 It should remove any number of trailing slashes. Would you want to amend your commit accordingly (i.e., do not add a second commit, overwrite the current one with git commit --amend and then force-push)? Otherwise I can do it.

leihuayi commented 6 years ago

Done

f0k commented 6 years ago

Thanks! This implementation will fail if the string only consists of slashes, though. Could you please remove the if (!current_dir.empty()) check and add a current_dir.length() > 1 check to the while condition? If we're down to /, we want to keep it that way. Also it'd be nice if you could follow the code style of the remaining code (i.e., while ( instead of while(, and the opening brace of the while body on the same line as the while condition).

iammordaty commented 4 years ago

Hello! Any news here? Will this PR be merged?