konsave icon indicating copy to clipboard operation
konsave copied to clipboard

Can't add custom locations?

Open tripplehelix opened this issue 2 years ago • 14 comments

Describe the bug See information below

Expected behavior Backup files without issues

System information

  • OS or Linux distribution: Debian Sid
  • How did you install Konsave? PIP
  • What version of Konsave are you using? 2.1.2 Did you try updating? yes

Additional context

I keep getting:

Konsave: Exporting "zsh"...
Konsave: Source path doesn't exist
Please check the log at /home/tom/konsave_log.txt for more details.

which refers to this error:

Traceback (most recent call last):
  File "/home/tom/.local/lib/python3.10/site-packages/konsave/funcs.py", line 40, in inner_func
    function = func(*args, **kwargs)
  File "/home/tom/.local/lib/python3.10/site-packages/konsave/funcs.py", line 100, in copy
    assert os.path.exists(source), "Source path doesn't exist"
AssertionError: Source path doesn't exist

This is my config:


save:

    [...]

    zsh:
        location: "$HOME"
        entries:
            - .zshrc

I have also tried pointing the location using the full location and get the same error. What is happening and how do I fix it?

tripplehelix avatar May 08 '22 15:05 tripplehelix

The location you have entered does not exist. Please check if .zshrc really exists in your home directory. It is working for me.

Prayag2 avatar May 08 '22 16:05 Prayag2

It definitely is... this is also spewing the same error for 3 other locations that all exist.

image

Should it be "$HOME/tom" ? But then why wouldn't /home/tom/ work?

tripplehelix avatar May 08 '22 16:05 tripplehelix

Should it be "$HOME/tom" ?

No. $HOME is a placeholder that points to the current user's home directory so it's actually just /home/tom/. But you can also try putting /home/tom/ directly there, though if you then export your profile and share it to somebody, your .zshrc file won't be copied to their home directory (it will try to find /home/tom/ in their PC which obviously won't exist as long as the usernames are not same).

Prayag2 avatar May 08 '22 17:05 Prayag2

Can you please share the whole config file?

Prayag2 avatar May 08 '22 17:05 Prayag2

---
# This is the configuration file for konsave.
# This file is pre-configured for KDE Plasma users.
# This will backup all the important files for your Plasma customizations.
# Please make sure it follows the correct format for proper working of Konsave.
# The format should be:
# ---
# save:
#     name:
#         location: "path/to/parent/directory"
#         entries: 
#         # these are files which will be backed up. 
#         # They should be present in the specified location.
#             - file1
#             - file2
# export:
#     # This includes files which will be exported with your profile.
#     # They will not be saved but only be exported and imported.
#     # These may include files like complete icon packs and themes..
#     name:
#         location: "path/to/parent/directory"
#         entries: 
#             - file1
#             - file2
# ...
# You can use these placeholders in the "location" of each item:
# $HOME: the home directory
# $CONFIG_DIR: refers to "$HOME/.config/"
# $SHARE_DIR: refers to "$HOME/.local/share"
# $BIN_DIR: refers to "$HOME/.local/bin"
# ${ENDS_WITH="text"}: for folders with different names on different computers whose names end with the same thing.
# The best example for this is the "*.default-release" folder of firefox.
# ${BEGINS_WITH="text"}: for folders with different names on different computers whose names start with the same thing.

save:
    configs:
        location: "$CONFIG_DIR"
        entries:
            - gtk-2.0
            - gtk-3.0
            - gtk-4.0
            - Kvantum
            - latte
            - dolphinrc
            - konsolerc
            - kcminputrc
            - kdeglobals
            - kglobalshortcutsrc
            - klipperrc
            - krunnerrc
            - kscreenlockerrc
            - ksmserverrc
            - kwinrc
            - kwinrulesrc
            - plasma-org.kde.plasma.desktop-appletsrc
            - plasmarc
            - plasmashellrc
            - gtkrc
            - gtkrc-2.0
            - lattedockrc
            - breezerc
            - oxygenrc
            - lightlyrc
            - ksplashrc
            - khotkeysrc
            - yakuakerc

    app_layouts:
        location: "$HOME/.local/share/kxmlgui5"
        entries:
            - dolphin
            - konsole

    # Here are a few examples of how you can add more stuff to back up.
    # Uncomment these lines if you want.
    # firefox:
    #     location: "$HOME/.mozilla/firefox/${ENDS_WITH='.default-release'}"
    #     entries:
    #         - chrome # for firefox customizations

    # code oss:
    #     location: "$CONFIG_DIR/Code - OSS/User/"
    #     entries:
    #         - settings.json

    zsh:
        location: "$HOME"
        entries:
            - .zshrc

    oh-my-zsh-theme:
        location: "$HOME/.oh-my-zsh/custom/themes"
        entries:
            - tom.zsh-theme

    oh-my-zsh-plugin:
        location: "$HOME/.oh-my-zsh/custom/plugins"
        entries:
            - zsh-autocomplete  
            - zsh-autosuggestions  
            - zsh-syntax-highlighting

    scripts:
        location: "$BIN_DIR"
        entries: 
            - gay
            - lfs
            - stonks
            - ufetch
            - dict
            - mountnas
            - update
            
# The following files will only be used for exporting and importing.
export:
    share_folder:
        location: "$SHARE_DIR"
        entries:
            - plasma
            - kwin
            - konsole
            - fonts
            - color-schemes
            - aurorae
            - icons
            - wallpapers

    home_folder:
        location: "$HOME/"
        entries:
            - .fonts
            - .themes
            - .icons
    
        
    # You can add more files to export like this
    # name:
    #     location: "path/to/parent/directory"
    #     entries:
    #         - file1
    #         - file2
    #         - folder1
    #         - folder2
...

tripplehelix avatar May 08 '22 17:05 tripplehelix

Do you get this error with the default config file?

Prayag2 avatar May 08 '22 17:05 Prayag2

No everything default works fine, for some reason additions to

    configs:
        location: "$CONFIG_DIR"

Also don't show up in the archive... am I doing something wrong?

I run the command via konsave -e tomkde

my profile 'tomkde' is located here ~/.config/konsave/profiles/tomkde/conf.yaml

tripplehelix avatar May 08 '22 17:05 tripplehelix

Did you save the profile before exporting? You have to do konsave -s <profile-name> before you can export it to an archive.

Prayag2 avatar May 08 '22 17:05 Prayag2

No everything default works fine, for some reason additions to

   configs:
       location: "$CONFIG_DIR"

Also don't show up in the archive... am I doing something wrong?

These additions are hidden files. Make sure that you have enabled "show hidden files" in your file manager.

Prayag2 avatar May 08 '22 17:05 Prayag2

Did you save the profile before exporting? You have to do konsave -s <profile-name> before you can export it to an archive.

That was the issue! Thanks, that fixed it.

tripplehelix avatar May 08 '22 17:05 tripplehelix

Glad it worked :)

Prayag2 avatar May 08 '22 17:05 Prayag2

But I'll open this issue again. Because I just noticed that the user should be aware of the fact that the profile needs to be saved first. I'll add a message in the help text and make it so that it will throw an error if the profile doesn't exist :)

Prayag2 avatar May 08 '22 17:05 Prayag2

The profile existed, I had just edited the file ~/.config/konsave/profiles/tomkde/conf.yaml instead of just editing ~/.config/konsave/conf.yaml then resaving.

tripplehelix avatar May 08 '22 17:05 tripplehelix

Oh

Prayag2 avatar May 08 '22 18:05 Prayag2