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

File.new "foo.txt" . parent returns Nothing #8906

Closed
radeusgd opened this issue Jan 30, 2024 · 1 comment · Fixed by #9642
Closed

File.new "foo.txt" . parent returns Nothing #8906

radeusgd opened this issue Jan 30, 2024 · 1 comment · Fixed by #9642
Assignees
Labels
-libs Libraries: New libraries to be implemented p-medium Should be completed in the next few sprints

Comments

@radeusgd
Copy link
Member

As shortly discussed a relative path will return Nothing if we cannot go 'up' anymore:

> File.new '.' . parent
>>> Nothing
> File.new 'foo.txt' . parent
>>> Nothing

To get the actual parent directory, we need to first get the absolute path:

> File.new '.' . absolute . normalize . parent
>>> (File X:\NBO)
> File.new 'foo.txt' . absolute . normalize . parent
>>> (File X:\NBO\enso)

I'm not exactly sure if this is right. I think ideally we should automatically switch to an absolute path if the relative parent cannot 'go up' anymore (although, keeping the path relative as long as possible). I.e. I'd suggest:

File.new "foo/bar/baz.txt" . parent # is relative `foo/bar`
File.new "foo.txt" . parent # becomes absolute `X:\NBO\enso`

However, maybe other approach should be taken.

Let's discuss if this is right or if another solution would be better, or maybe if we should just keep the current behaviour unchanged.

@radeusgd radeusgd added the -libs Libraries: New libraries to be implemented label Jan 30, 2024
@jdunkerley jdunkerley moved this from ❓New to 📤 Backlog in Issues Board Feb 6, 2024
@jdunkerley jdunkerley added the p-medium Should be completed in the next few sprints label Feb 13, 2024
@radeusgd radeusgd moved this from 📤 Backlog to 🔧 Implementation in Issues Board Apr 5, 2024
@radeusgd radeusgd moved this from 🔧 Implementation to 👁️ Code review in Issues Board Apr 5, 2024
@enso-bot
Copy link

enso-bot bot commented Apr 8, 2024

Radosław Waśko reports a new STANDUP for the provided date (2024-04-05):

Progress: Added some other edge cases to File.parent handling as well as changed how File.name works with .. and . It should be finished by 2024-04-09.

Next Day: Next day I will be working on the #9363 task. Fix a broken test issue on Enso_File path refactor. Add retries to HTTP tests (asked for by Hubert). Start work on path resolver integration.

@mergify mergify bot closed this as completed in #9642 Apr 8, 2024
mergify bot pushed a commit that referenced this issue Apr 8, 2024
@github-project-automation github-project-automation bot moved this from 👁️ Code review to 🟢 Accepted in Issues Board Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-libs Libraries: New libraries to be implemented p-medium Should be completed in the next few sprints
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants