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

Is there some way to *NOT* use ~/Documents/Fritzing for the user parts tree? #4188

Open
RobertPHeller opened this issue Oct 14, 2024 · 18 comments

Comments

@RobertPHeller
Copy link

I don't want to have a $HOME/Documents directory on my Linux system. I find having the "standard" set of directories (no I won't call them folders -- folders are something completely different) obnoxious. I could not find a preference setting. I am using the ARM64 build in the Debian 12 repo on a Raspberry Pi 5: Version 0.9.6
(b ) 32 [Qt 5.15.6]:

marchhare% dpkg-query -l fritzing
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-==================================>
ii fritzing 0.9.6+dfsg-3 arm64 Easy-to-use electronic design soft>

@KjellMorgenstern
Copy link
Member

KjellMorgenstern commented Oct 19, 2024

Right now, it is not possible. Fritzing use QtStandardPaths, to choose standardized paths.

When a user downloads or creates a part, and loads it into Fritzing, where should Fritzing store this?
A similar question would be, where should Fritzing store a writable parts database, like a sqlite database?

Unfortunately, changing this path, or introducing a QSetting for it, is not straightforward.
There are multiple places, where the order of paths is important, and where Fritzing uses fallback paths, e.g. when loading am obsolete part, a user provided part, imported part, core part, core part that was modified (git hash differs). This makes it complex and risky to change things.

@RobertPHeller
Copy link
Author

RobertPHeller commented Oct 19, 2024 via email

@malnvenshorn
Copy link

There is nothing wrong in using QtStandardPaths. But Fritzing should not use the DocumentsLocation. As the name implies, that's a location for documents and not a place for an app to dump random files. For application specific files use AppLocalDataLocation instead.

@RobertPHeller
Copy link
Author

RobertPHeller commented Oct 22, 2024 via email

@KjellMorgenstern
Copy link
Member

That are not random files. When you import a Fritzing part, by default you are adding it to your personal library.

@malnvenshorn
Copy link

malnvenshorn commented Oct 23, 2024

It's still application specific data and that doesn't belong to ~/Documents. Application data should be stored to ~/.local/share/APPNAME.

In case of doubt use the XDG standard https://specifications.freedesktop.org/basedir-spec/latest/

@RobertPHeller
Copy link
Author

RobertPHeller commented Oct 23, 2024 via email

@KjellMorgenstern
Copy link
Member

If a re-install of Fritzing would delete those files, I am pretty sure that a lot of users would be unhappy about loosing these files. I don't have any doubt that they are user data.

Anyway, this is distracting from the original issue. It seems to be more about overriding whatever the default is?

@RobertPHeller
Copy link
Author

RobertPHeller commented Oct 23, 2024 via email

@paulcobbaut
Copy link

How bizarre that such an awesome and popular program is not using ~/.local/share/fritzing/ for stuff that obviously belongs there. I also prefer my /home/paul/ to be clean of 'debris'.
Please consider changing this (apparently hard coded) setting to the standard.

$ ls
bin/  Desktop/  Downloads/  Fritzing/  My Games/  raid/ sourcecode/
$ ls .local/share/ | wc -l
98

@KjellMorgenstern
Copy link
Member

To avoid ambiguity, could you please list some example files from that location that you consider debris?

@RobertPHeller
Copy link
Author

RobertPHeller commented Dec 22, 2024 via email

@paulcobbaut
Copy link

To avoid ambiguity, could you please list some example files from that location that you consider debris?

Anything that is not a personal file that I create and want there, or anything that is unavoidable.

bin/ for personal binaries
My Games/ contains savegames
raid/ is the link to my Raid disks
sourcecode/ is well code that I write or change

Desktop/ and Downloads/ are unavoidable with XFCE

Fritzing/ is debris in my home directory. It should be in /home/paul/.local/share/ like all other applications do.

@paulcobbaut
Copy link

Right now the only files in ~/Documents are Fritzing's parts files.

Fritzing did not create this in my home directory. I also object to a ~/Documents directory by the way.

@KjellMorgenstern
Copy link
Member

The title of the issue literally states it: These are user parts, not the parts that come with Fritzing. If there are any parts, it is likely you created or downloaded them. If you do backups, you will want to include them. They will not be restored with a Fritzing reinstall.
I might be wrong, that is why I asked for examples.

If "Documents" as a standard is a concern, this could be a good starting point: https://cgit.freedesktop.org/xdg/xdg-user-dirs/tree/user-dirs.defaults , at least for Linux. I don't know if Microsoft or Apple have place to address this, but to my knowledge they create Documents folders, too. Out of curiosity, what system are you using to not have this folder created by default for each user?

A related issue, which I think is important here, is that the Documents folder increasingly often gets (even by default) synced as a OneDriver folder, and there are some reports that this does not work well with Fritzing. This is an issue I'd like to spend resources on. A custom folder location would help, but only so far, until it gets used (and I think this is the more common feature request, and therefore dangerous), to specifically point it to a network location, to share Fritzing projects across multiple machines. That is a good feature to have, but would release havoc on the data with the current way files are handled.

@paulcobbaut
Copy link

paulcobbaut commented Dec 22, 2024

Disclaimer: I still think this program is awesome and will keep on using it.
Out of hundreds of applications Fritzing is the only one with its own directory in my $HOME and it bugs me.

The title of the issue literally states it: These are user parts, not the parts that come with Fritzing.

The directories are created, even when I download nothing.

If there are any parts, it is likely you created or downloaded them.

No. They are there after apt install fritzing and opening the program.

If you do backups, you will want to include them.

Doubtful. Why would I include files that can be downloaded in a backup?
Also not relevant, since it's trivial to backup $HOME which would include all these parts.
Also the directories are plenty but empty, as can be seen in this screenshot.

$ find parts -type d
parts
parts/svg
parts/svg/contrib
parts/svg/contrib/schematic
parts/svg/contrib/breadboard
parts/svg/contrib/icon
parts/svg/contrib/pcb
parts/svg/user
parts/svg/user/schematic
parts/svg/user/breadboard
parts/svg/user/icon
parts/svg/user/pcb
parts/contrib
parts/user
$ find parts -type f
$

They will not be restored with a Fritzing reinstall. I might be wrong, that is why I asked for examples.

If "Documents" as a standard is a concern, this could be a good starting point: https://cgit.freedesktop.org/xdg/xdg-user-dirs/tree/user-dirs.defaults , at least for Linux.

I read this:
https://specifications.freedesktop.org/basedir-spec/latest/

More specifically this:
"$XDG_DATA_HOME defines the base directory relative to which user-specific data files should be stored. If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used. "

Though I would also be happy with the old standard of $HOME/.fritzing/

I don't know if Microsoft or Apple have place to address this, but to my knowledge they create Documents folders, too. Out of curiosity, what system are you using to not have this folder created by default for each user?

Installation was four years ago, I may have done rmdir ~/Documents
Here a sysfetch command without the hardware:

$ sysfetch 
paul@PC
Uptime: 127 days, 6 hours, 22 minutes
Kernel: Linux 6.1.0-22-amd64 x86_64
OS: linux-gnu
RAM: 19507/64222 MiB 30%
Distro: Debian GNU/Linux 12 (bookworm)
GENV: XFCE
Packages: 4228

A related issue, which I think is important here, is that the Documents folder increasingly often gets (even by default) synced as a OneDriver folder, and there are some reports that this does not work well with Fritzing. This is an issue I'd like to spend resources on. A custom folder location would help, but only so far, until it gets used (and I think this is the more common feature request, and therefore dangerous), to specifically point it to a network location, to share Fritzing projects across multiple machines. That is a good feature to have, but would release havoc on the data with the current way files are handled.

I have hope that people capable of designing schematics are also capable of understanding directories.

Hopefully one day this project will use one of the common locations in Linux to put these files. I consider this a feature request and not a bug.

Thanks for you time.

@KjellMorgenstern
Copy link
Member

I only tested this on Ubuntu 22.04. If you don't have or want a Documents folder, maybe you can try this workaround:


fritzing@ubuntu2204lts:~$ cat ~/.config/user-dirs.dirs
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run.
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
# 
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/FooBar"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"

then start Fritzing. It will respect the XDG_DOCUMENTS_DIR folder, at least it did when I just tried this.

fritzing@ubuntu2204lts:~$ find FooBar/
FooBar/
FooBar/Fritzing
FooBar/Fritzing/parts
FooBar/Fritzing/parts/user
FooBar/Fritzing/parts/svg
FooBar/Fritzing/parts/svg/user
FooBar/Fritzing/parts/svg/user/pcb
FooBar/Fritzing/parts/svg/user/icon
FooBar/Fritzing/parts/svg/user/schematic
FooBar/Fritzing/parts/svg/user/breadboard
FooBar/Fritzing/parts/svg/contrib
FooBar/Fritzing/parts/svg/contrib/pcb
FooBar/Fritzing/parts/svg/contrib/icon
FooBar/Fritzing/parts/svg/contrib/schematic
FooBar/Fritzing/parts/svg/contrib/breadboard
FooBar/Fritzing/parts/contrib
FooBar/Fritzing/bins
FooBar/Fritzing/bins/my_parts.fzb
FooBar/Fritzing/bins/search.fzb

XDG_DATA_DIRS folders is a list off folders that a regular user does not have write access:

fritzing@ubuntu2204lts:~$ echo $XDG_DATA_DIRS 
/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop

@paulcobbaut
Copy link

That works. Thanks!!!

$ echo $XDG_DOCUMENTS_DIR 
/home/paul/.local/share/
$ ll .local/share/Fritzing/
total 8.0K
drwxr-xr-x 2 paul paul 4.0K Dec 23 08:18 bins
drwxr-xr-x 5 paul paul 4.0K Dec 23 08:18 parts

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

No branches or pull requests

4 participants