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

Notify user when config directory can't be created because there is already a file with the same name #1134

Merged
merged 19 commits into from
Jan 2, 2021

Conversation

micahellison
Copy link
Member

@micahellison micahellison commented Dec 27, 2020

Fixes #659. It catches an exception in the XDG method and lets the user know exactly where the problem is.

While working on this, I noticed that a ton of configuration code was in the install.py file, so I moved it to config.py as necessary and updated the tests to use patches instead of a global. The configuration code still needs a lot of work but I hope this is at least a step in the right direction.

I couldn't come up with a good strategy to automatically test this issue, since XDG is essentially global to the program. Here's my manual test:

C:\dev\jrnl>copy con C:\Users\micah\.config\jrnl
this is a text file
^Z
        1 file(s) copied.

C:\dev\jrnl>jrnl --ls
The path to your jrnl configuration directory is a file, not a directory:
C:\Users\micah\.config\jrnl
Removing this file will allow jrnl to save its configuration.

C:\dev\jrnl>del C:\Users\micah\.config\jrnl

C:\dev\jrnl>jrnl --ls
Path to your journal file (leave blank for C:\Users\micah\.local\share\jrnl\journal.txt):
Do you want to encrypt your journal? You can always change this later [y/N]
Journals defined in C:\Users\micah\.config\jrnl\jrnl.yaml
 * default -> C:\Users\micah\.local\share\jrnl\journal.txt

Checklist

  • I have read the contributing doc.
  • I have included a link to the relevant issue number.
  • I have tested this code locally.
  • I have checked to ensure there aren't other open pull requests
    for the same issue.
  • I have written new tests for these changes, as needed.
  • All tests pass.

jrnl/cli.py Outdated Show resolved Hide resolved
features/core.feature Outdated Show resolved Hide resolved
Copy link
Member

@wren wren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤠

@wren wren added the bug Something isn't working label Jan 2, 2021
@wren wren changed the title Notify user when XDG configuration directory can't be made because there is already a file with the same name Notify user when config directory can't be created because there is already a file with the same name Jan 2, 2021
@wren wren merged commit c155baf into jrnl-org:develop Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Commands fail if a file conflicts with the config directory
3 participants