Skip to content

Simplify incrementFileName#75398

Merged
isidorn merged 4 commits intomicrosoft:masterfrom
jeanp413:simplify-incrementFileName
Jun 17, 2019
Merged

Simplify incrementFileName#75398
isidorn merged 4 commits intomicrosoft:masterfrom
jeanp413:simplify-incrementFileName

Conversation

@jeanp413
Copy link
Copy Markdown
Contributor

Fixes #55128

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

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
Copy Markdown
Collaborator

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
Copy Markdown
Collaborator

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
Copy Markdown
Contributor Author

jeanp413 commented Jun 14, 2019

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

@isidorn
Copy link
Copy Markdown
Collaborator

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