usethis icon indicating copy to clipboard operation
usethis copied to clipboard

rename_files breaks with . in old or new

Open jonthegeek opened this issue 3 months ago • 0 comments

I'm not sure how to create a complete reprex for this. I definitely recommend making sure everything is committed in whatever directory you're using if you're in a real project.

I was trying to organize a directory better, and had the idea of using "." within some filenames. It wouldn't have actually sorted how I want, but I would have seen that when I tried.

Except it truncated at the ., so

rename_files("generate_security", "generate_pkg.security")

was treated as

rename_files("generate_security", "generate_pkg")

Once I ran it it made sense, but I wasn't expecting it, and it made a mess of some things. I think I've recovered everything, but it would definitely be possible to lose work.

I'd recommend either requiring a confirmation if anything other than .R would be truncated, and/or maybe requiring that all work be checked in before running (rather than just checking for using git).

I can probably PR if you'd like to implement this. Let me know if you have a preference for what to implement.

jonthegeek avatar Mar 27 '24 15:03 jonthegeek