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

Simplify incrementFileName #75398

Merged
merged 4 commits into from
Jun 17, 2019

Conversation

jeanp413
Copy link
Contributor

Fixes #55128

});
// name copy 5(.txt) => name copy 6(.txt)
// name copy(.txt) => name copy 2(.txt)
let suffixRegex = /^(.+ copy)( \d+)?$/;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prefer to use const over let when possible

});
let namePrefix = name;
let extSuffix = '';
if (!isFolder) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it help to use the paths.extname helper to simplify things here?

@isidorn
Copy link
Contributor

isidorn commented Jun 14, 2019

This is some great work. I love it, especailly the tests!
I was thinking if the differentiation between file and folder behavior is really necessery. But it seems that all native explorer have different behavior, so let's keep it like that. The corner case being I have a folder called "hello.t" -> "hello.t copy" instead of "hello copy.t". So let's keep the differentiation I think.

If you want you can address my two minor comments. I would merge this either way.

Thanks a lot!

@isidorn isidorn added this to the June 2019 milestone Jun 14, 2019
@jeanp413
Copy link
Contributor Author

jeanp413 commented Jun 14, 2019

@isidorn updated the PR, now I'm using extname and basename functions

@isidorn
Copy link
Contributor

isidorn commented Jun 17, 2019

Great work, merging in.
Thanks a lot!

@isidorn isidorn merged commit 9f3f18b into microsoft:master Jun 17, 2019
@jeanp413 jeanp413 deleted the simplify-incrementFileName branch July 5, 2019 02:59
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Making copy/paste filename incrementor switchable off
2 participants