JohnSundell / JohnSundell/Files

Rename Item API

Open
#67 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
2.6k
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Hi @JohnSundell ,

I'm enjoying the Files API and I'm glad I can help in any way. Even if my contributions are just discussion points that lead to potential pull requests from others.

I have, yet another, discussion point to raise. I hope you don't mind.

### RenameItem

Unless I examine the source, it's not clear here if `newName` is `name only` or `name + extension`.

```
public func rename(to newName: String, keepExtension: Bool = true) throws
```

Further, I currently have a situation where the above API is inconvenient.

At the moment I'm unpacking a .pdf file from a CKAsset instance (CloudKit).

1. After digging through the asset, I find a file named asdkfjkajsdkfha.**owkheorhjdsf**
2. The file is stored in temp dir so I need to also move it.
3. I want the file to have a different name, including a new `.pdf` extension.

Perhaps, we might want to have something like the following?

```
public func rename(to newName: String) throws
```

And maybe we can examine the name to see if it contains a `"."`

Do you think this is a valid issue and do you have any ideas on this?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.