Home dir support for python plugins on all platforms

Bug #1740776 reported by eelik
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
KiCad
Invalid
Undecided
Unassigned

Bug Description

The user's home dir is not supported for python plugins on all platforms, only on Linux. It should be easy because there's os.path.expanduser() functions which "On Unix and Windows, return the argument with an initial component of ~ or ~user replaced by that user’s home directory."

In kicadplugins.i there's

if sys.platform.startswith('linux'):
        plugin_directories.append(os.path.join(os.environ['HOME'],'.kicad_plugins'))
        plugin_directories.append(os.path.join(os.environ['HOME'],'.kicad','scripting'))
        plugin_directories.append(os.path.join(os.environ['HOME'],'.kicad','scripting','plugins

which could probably be replaced with

#for all platforms
plugin_directories.append(os.path.join(os.path.expanduser('~'),'.kicad_plugins'))
plugin_directories.append(os.path.join(os.path.expanduser('~'),'.kicad','scripting'))
plugin_directories.append(os.path.join(os.path.expanduser('~'),'.kicad','scripting','plugins'))

(NOTE: NOT TESTED)

Tags: python
tags: added: python
Revision history for this message
eelik (eelik) wrote :

Actually I was probably wrong, I don't remember anymore why I thought the user directory doesn't work on Windows. Apparently config_path (above the quoted lines) should add a user's directory to the list. But making the change shouldn't hurt, either.

eelik (eelik)
Changed in kicad:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.