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

Add a way to modify file extensions #46

Open
karwa opened this issue May 9, 2021 · 0 comments
Open

Add a way to modify file extensions #46

karwa opened this issue May 9, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@karwa
Copy link
Owner

karwa commented May 9, 2021

e.g. changing myfile.jpg to myfile.zip. Particularly useful for "file" URLs.

Possibly implement with an extension on String? Extensions can be useful anywhere inside a path, for example:

let url = WebURL("file:///Applications/MyApp.app/Contents/Resources/foo")!

if let appBundleDirIdx = url.pathComponents.lastIndex(where: { $0.fileExtension == "app" }) {
  let pathInsideBundleIdx = url.pathComponents.index(after: appBundleDirIdx)
  let pathInsideBundle = url.pathComponents[pathInsideBundleIdx...] // "/Contents/Resources/foo"
}
@karwa karwa added the enhancement New feature or request label Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant