Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

fix(config): relative path in config.toml should resolve relative to where config.toml is #385

Open
3 tasks done
qti3e opened this issue Feb 13, 2023 · 4 comments
Open
3 tasks done

Comments

@qti3e
Copy link
Member

qti3e commented Feb 13, 2023

Description

Currently, whenever a PathBuf is resolved within config.toml in case it is a relative path (for example: ./database), the path is resolved from the current working directory (cwd) which leads to different configuration versions even when the same config file is used when running ursa from other directories. IMHO this is a confusing behavior since whenever a config.toml is being edited by a possible user, they are laser-focused on where their config file is located when editing.

Fix

An easy fix, is to change processes cwd to config's directory before loading the config and cd to the initial cwd after config is loaded. Or... we can use contextual loading.

Checklist

  • I have ensured that my version is up-to-date
  • I have ensured that my issue is reproducible
  • I have ensured that my issue is not a duplicate
@ozwaldorf
Copy link
Member

I think it's expected when using relative paths that they'd be relative to where you run though?

@qti3e
Copy link
Member Author

qti3e commented Feb 13, 2023

@ozwaldorf imagine that was the behavior in your vim config.

@ozwaldorf
Copy link
Member

@ozwaldorf imagine that was the behavior in your vim config.

ahh didn't fully understand. Yeah i agree we should resolve all paths inside config.toml from the config.toml path. Although for now using full paths works fine

@qti3e
Copy link
Member Author

qti3e commented Feb 13, 2023

@ozwaldorf yeah agreed. let's not change it for now...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants