Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-4247

New method: File.renameTo(String path)

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • None
    • 1.7.4, 1.8-beta-1
    • groovy-jdk
    • None

    Description

      Currently File's renameTo takes in a File object. I think it would be groovier to allow a String to be passed in representing the rename - having to create a File to rename to seems a little strange.

      Something like,

      public boolean renameTo(String path)
      {
      return this.renameTo(new File(path))
      }

      Calling code now becomes,

      file.renameTo("/somewhere/file.txt")

      instead of

      file.renameTo(new File("/somewhere/file.txt"))

      Attachments

        Activity

          roshandawrani Roshan Dawrani added a comment -

          Hi. Any objections to adding this convenience method?

          roshandawrani Roshan Dawrani added a comment - Hi. Any objections to adding this convenience method?

          No objection, good idea.

          guillaume Guillaume Sauthier added a comment - No objection, good idea.
          roshandawrani Roshan Dawrani added a comment -

          Done.

          roshandawrani Roshan Dawrani added a comment - Done.

          People

            roshandawrani Roshan Dawrani
            sproaty Steven Sproat
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 20m
                20m
                Remaining:
                Remaining Estimate - 20m
                20m
                Logged:
                Time Spent - Not Specified
                Not Specified