-
Notifications
You must be signed in to change notification settings - Fork 71
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
feat(env): Make rustic more portable #1059
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8dd15bd
feat(env): Make rustic more portable
simonsan 6a6b42f
fix(config): Use join and don't push to PathBuf
simonsan fc1a52e
docs(config): rewrite parts of profile section to account for profile…
simonsan 6f26e05
style: fmt
simonsan 4e89670
chore: apply fixes from review
simonsan 4934499
chore: fix clippy lints by allowing due to os dependent impl
simonsan b96173b
refactor: return a collection of optional PathBufs from portability f…
simonsan 6edf7e6
refactor: replace push with join
simonsan bf56c87
docs: add comment to explain, why we need to have a lint allowed
simonsan b75df65
Merge branch 'main' into feat/home
simonsan b8f7ec0
Merge branch 'main' into feat/home
simonsan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not simply add two entries
here? If this seems to heavy, create 2 functions which return these results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't understand. Instead of what should we do that, you marked
get_home_config_path(),
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean like that:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that was the idea, I found it a bit cleaner, although we need to have all that lint deactivated and mutable variable, to have that in its own function. Just because, we can have access to that, to just get the config paths singly, when we need them.
For example, this:
would work, but would not let us have
RUSTIC_HOME
access in a function, if we just need it for something else, e.g. opening a pdf in that folder, when we would want to open documentation or anything else in the home folder. Also I feel it makes it a bit 'chaotic' somehow, at least from reading it, but this may be personal preference.Hence I think extracting these things into their own functions is better long-term.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, then simply use
get_userprofile_config_rustic()
andget_userprofile_rustic()
or something like this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about it, all those directories are a bit different:
RUSTIC_HOME
: we useRUSTIC_HOME/config
here for the configs,RUSTIC_HOME/logs
I reserved onscoop
for log filesUSERPROFILE\.config\rustic
: we use a root directory here for the configsUSERPROFILE\.rustic
: same here, we use a root directoryI think consistency is important in that regard, so people can for example use their
rustic-package
unpack it, change some configs and start. Which would mean, that we would needconfig/
as a subdirectory in each of these, although it doesn't make a lot of sense inUSERPROFILE\.config\rustic
to have another subdir forconfig
. But then, we also can't use this directory as a kind of HOME directory, where for example alsolog
files would be found and other resources. 🤔