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

expandFilename works only on existing files and directories. #6486

Closed
FedericoCeratto opened this issue Oct 8, 2017 · 4 comments
Closed
Labels
Documentation Content Related to documentation content (not generation). OS (stdlib) Related to OS modules in standard library Standard Library

Comments

@FedericoCeratto
Copy link
Member

Also, the documentation does not mention this behavior.

@dom96
Copy link
Contributor

dom96 commented Oct 20, 2017

So unless there is a use case for this I think it's fine to just document this behaviour.

@dom96 dom96 added the Documentation Content Related to documentation content (not generation). label Oct 20, 2017
@FedericoCeratto
Copy link
Member Author

Expanding file names is very common for logging (you don't want to log out a relative path). A typical use case is to log out that you are going to create a file before doing so.

@andreaferretti
Copy link
Collaborator

I think one reason it work like that is symlinks (assuming this function also resolves them). You cannot expand the filename without knowing whether some intermediate part is a symlink, and for that you have to touch the filesystem and work on existing paths. If instead this is a pure function with no reference to the filesystem, it makes sense that it works at an abstract level without requiring files to exist

@FedericoCeratto FedericoCeratto changed the title expandFilename work only on existing files and directories. expandFilename works only on existing files and directories. Oct 15, 2018
FedericoCeratto pushed a commit to FedericoCeratto/Nim that referenced this issue Oct 15, 2018
FedericoCeratto pushed a commit to FedericoCeratto/Nim that referenced this issue Oct 16, 2018
FedericoCeratto pushed a commit to FedericoCeratto/Nim that referenced this issue Oct 18, 2018
@timotheecour timotheecour added the OS (stdlib) Related to OS modules in standard library label Oct 25, 2018
@Araq
Copy link
Member

Araq commented Feb 23, 2019

I think it's fine.

proc expandFilename*(filename: string): string {.rtl, extern: "nos$1",
  tags: [ReadDirEffect], noNimScript.} =
  ## Returns the full (`absolute`:idx:) path of an existing file `filename`.
  ##
  ## Raises `OSError` in case of an error. Follows symlinks.

@Araq Araq closed this as completed Feb 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Content Related to documentation content (not generation). OS (stdlib) Related to OS modules in standard library Standard Library
Projects
None yet
Development

No branches or pull requests

5 participants